【发布时间】:2016-12-17 13:36:24
【问题描述】:
这在开发过程中似乎是随机发生的。尝试运行npm start 或react-native run-ios 时,出现以下错误:
Failed to build DependencyGraph: @providesModule naming collision:
Duplicate module name: react-native-vector-icons
Paths: /Users/chandlervdw/Repos/Relay/mobile/node_modules/react-native/local-cli/rnpm/core/test/fixtures/files/package.json collides with /Users/chandlervdw/Repos/Relay/mobile/node_modules/react-native/Libraries/Animated/release/package.json
This error is caused by a @providesModule declaration with the same name accross two different files.
Error: @providesModule naming collision:
Duplicate module name: react-native-vector-icons
Paths: /Users/chandlervdw/Repos/Relay/mobile/node_modules/react-native/local-cli/rnpm/core/test/fixtures/files/package.json collides with /Users/chandlervdw/Repos/Relay/mobile/node_modules/react-native/Libraries/Animated/release/package.json
This error is caused by a @providesModule declaration with the same name accross two different files.
at HasteMap._updateHasteMap (/Users/chandlervdw/Repos/Relay/mobile/node_modules/node-haste/lib/DependencyGraph/HasteMap.js:162:15)
at /Users/chandlervdw/Repos/Relay/mobile/node_modules/node-haste/lib/DependencyGraph/HasteMap.js:140:25
奇怪的是,/Users/chandlervdw/Repos/Relay/mobile/node_modules/react-native/local-cli/rnpm/core/test/fixtures/files/package.json 实际上确实将react-native-vector-icons 列为模块的名称???
如果我删除该文件,错误将不再发生,但打包程序卡在 93% 并抱怨找不到完全不相关的库。
我吹走了我的 repo,甚至重新安装了所有东西,包括npm、rnpm,甚至升级了node。我正在运行与我的队友相同的版本,他们能够毫无问题地运行打包程序。
【问题讨论】:
-
我知道这听起来很傻,但是您是否尝试过使用 sudo 权限运行,我在尝试为 Android 构建 react-native 并使用 sudo 运行时遇到了类似的错误解决了冲突。
-
@Alex 你开个玩笑。那行得通!但是为什么?!?!因为这个,我失去了一整天的工作......
-
@chandlervdw 相信我,伙计,这周我确实发生了同样的事情,很抱歉你不得不在这个错误上浪费这么多时间......我也把头撞在墙上了像你一样用尽所有其他途径!难道你不只是喜欢 npm 包管理器,有时哈哈!很高兴它为你排序:)
-
我的猜测是,在构建该软件包时,它需要访问一些受限资源,这些资源需要 sudo 授予的提升权限...我只是希望错误代码不要那么模糊!
-
谢谢 - 周末花了几个小时得到随机的红屏,难以置信!很棒的提示,已添加书签!
标签: node.js npm react-native packager