当我在react-native项目中安装NativeBase和React-Native-Router-Flux时,我收到此错误:
Failed to build DependencyGraph: @providesModule naming collision:
Duplicate module name: react-native-vector-icons
Paths: /Users/vittori/Desktop/repos/GitHubExamples/native-starter-kit/node_modules/react-native/local-cli/core/__fixtures__/files/package.json collides with /Users/vittori/Desktop/repos/GitHubExamples/native-starter-kit/node_modules/react-native-router-flux/node_modules/react-native/local-cli/core/__fixtures__/files/package.json
This error is caused by a @providesModule declaration with the same name across two different files.
Error: @providesModule naming collision:
Duplicate module name: react-native-vector-icons
Paths: /Users/vittori/Desktop/repos/GitHubExamples/native-starter-kit/node_modules/react-native/local-cli/core/__fixtures__/files/package.json collides with /Users/vittori/Desktop/repos/GitHubExamples/native-starter-kit/node_modules/react-native-router-flux/node_modules/react-native/local-cli/core/__fixtures__/files/package.json
This error is caused by a @providesModule declaration with the same name across two different files.
at HasteMap._updateHasteMap (/Users/vittori/Desktop/repos/GitHubExamples/native-starter-kit/node_modules/react-native/packager/src/node-haste/DependencyGraph/HasteMap.js:159:13)
at p.getName.then.name (/Users/vittori/Desktop/repos/GitHubExamples/native-starter-kit/node_modules/react-native/packager/src/node-haste/DependencyGraph/HasteMap.js:134:31)
答案 0 :(得分:5)
已发布解决方案here
yarn add react-native-router-flux@3.38.0
答案 1 :(得分:0)
您应该可以更新
react-native-router-flux使用:
npm i react-native-router-flux --save
尝试启动react-native packager可能会再次失败并且运行可能很有用:
1. Clear watchman watches: `watchman watch-del-all`.
2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
3. Reset packager cache: `rm -fr $TMPDIR/react-*` or `npm start --reset-cache`.
您可能会看到一次尝试再次运行打包程序错误,例如:
Failed to build DependencyGraph: @providesModule naming collision:
Duplicate module name
您可能需要再次运行react-native-router-flux的npm install。
答案 2 :(得分:0)
如果您使用纱线,请运行此命令。
yarn add react-native-router-flux@3.38.0
如果您使用npm,请运行此命令。
npm install react-native-router-flux@3.38.0 --save
此外,您仍然遇到问题,请将react-native版本降级为0.41.2。
然后,它会起作用。
答案 3 :(得分:0)
NativeBase 2.1.4解决了这个问题