7

当我在我的 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)
4

4 回答 4

6

解决方案已发布here

yarn add react-native-router-flux@3.38.0

于 2017-04-21T21:08:29.037 回答
0

您应该能够使用以下方法更新 react-native-router-fluxnpm i react-native-router-flux --save

尝试启动 react-native 打包程序可能再次失败并且运行可能有用:

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。

于 2017-04-21T17:51:26.560 回答
0

NativeBase 2.1.4解决了这个问题

于 2017-05-26T04:24:10.683 回答
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。

然后,它将起作用。

于 2017-04-26T20:17:28.153 回答