重复的模块名称:react-native-vector-icons

Duplicate module name: react-native-vector-icons

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

你应该可以更新 react-native-router-flux 使用: npm i react-native-router-flux --save

可能是尝试启动 react-native packager 再次失败,运行ning 可能有用:

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。

已发布解决方案here

yarn add react-native-router-flux@3.38.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。

然后,它会起作用。

NativeBase 2.1.4 解决了这个问题