React-Native包装程序失败:重复的模块名称

这在发展过程中看似随机发生。 当试图运行npm startreact-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 /Users/chandlervdw/Repos/Relay/mobile/node_modules/react-native/local-cli/rnpm/core/test/fixtures/files/package.json react-native-vector-icons /Users/chandlervdw/Repos/Relay/mobile/node_modules/react-native/local-cli/rnpm/core/test/fixtures/files/package.json实际上列出了react-native-vector-icons作为名字该模块?

如果我删除该文件,错误不再发生,但包装卡住在93%,并抱怨一个完全无关的图书馆没有被发现。

我吹走了我的回购,甚至重新安装了一切,包括npmrnpm ,甚至升级node 。 我运行与我的队友相同的版本,他们能够毫无问题地运行打包程序。

将此作为答案,以防将来有其他人遇到此问题。

当节点包pipe理器正在运行初始构build阶段时,使用sudo权限运行npm start授予正确的权限。 这似乎只有在您运行的shell /用户具有受限特权时才会发生。 强制升级特权到sudo让包pipe理器完全控制完成构build。

我遇到了类似的错误

 Failed to build DependencyGraph: @providesModule naming collision: Failed to build DependencyGraph: @providesModule naming collision: Duplicate module name: accepts Duplicate module name: accepts 

我通过删除npm的caching.npm并使用--reset-cache重新运行packager程序来解决这个问题

 rm -rf ~/.npm 

sudochown没有为我修复它。 我从同一个图书馆得到同样的错误,很奇怪:

 Failed to build DependencyGraph: @providesModule naming collision: Duplicate module name: react-native-vector-icons Paths: /Users/collumj/research/k9fresh/ios/build/Build/Products/Debug-iphonesimulator/kisharNine.app/package.json collides with /Users/collumj/research/k9fresh/node_modules/react-native/local-cli/core/__fixtures__/files/package.json 

当我遇到这个时,不需要sudo

警告: 破坏性的 ,首先检查。

 rm -rf android ios git reset --hard npm start 

每次修复它。 RN 0.39.2

编辑:以后,我想我通过解除链接react-native-vector-icons lib来解决这个问题; 我想我得到的指示让我在链接上翻倍,或者不知何故已经过时了。

清理nvmcaching并重新安装所有node_modules后,我意识到我有这个问题,因为react-native-router-flux。

我将其react-native-router-flux@3.38.1 降级react-native-router-flux@3.38.0

更多细节在这里: https : //github.com/aksonov/react-native-router-flux/issues/1816