【发布时间】:2018-01-27 05:34:03
【问题描述】:
我正在尝试在 iOS 模式下运行一个 react native 项目。
$ react-native run-ios
但我在错误中运行
Failed to build DependencyGraph: @providesModule naming collision:
Duplicate module name: react-animated
Paths: /Users/mobile/node_modules/react-native-image-carousel/node_modules/react-native/Libraries/Animated/release/package.json collides with /Users/mobile/node_modules/react-native/Libraries/Animated/release/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-animated
Paths: /Users/mobile/node_modules/react-native-image-carousel/node_modules/react-native/Libraries/Animated/release/package.json collides with /Users/mobile/node_modules/react-native/Libraries/Animated/release/package.json
This error is caused by a @providesModule declaration with the same name across two different files.
at HasteMap._updateHasteMap (/Users/mobile/node_modules/react-native/packager/react-packager/src/node-haste/DependencyGraph/HasteMap.js:158:13)
at /Users/mobile/node_modules/react-native/packager/react-packager/src/node-haste/DependencyGraph/HasteMap.js:133:31
我不明白这个问题,真的需要一些帮助来解决问题。
这就是我设置系统的方式 (macOS Sierra):
$ brew install node
$ brew install watchman
$ sudo npm install -g react-native-cli
$ npm install invariant --save-dev
$ npm install
一切都应该安装好:
版本
$ node -v
v4.0.0
$ react-native -v
react-native-cli: 2.0.1
react-native: 0.40.0
$ watchman -v
4.7.0
package.json
{
"dependencies": {
"react": "~15.4.0-rc.4",
"react-native": "0.40.0",
"react-native-image-carousel": "^0.3.2",
"react-native-image-picker": "^0.25.7",
"react-native-local-mongodb": "^1.8.2"
},
"devDependencies": {
"babel-jest": "18.0.0",
"babel-preset-react-native": "1.9.1",
"invariant": "^2.2.2",
"jest": "18.1.0",
"react-test-renderer": "~15.4.0-rc.4"
},
"jest": {
"preset": "react-native"
}
}
npm 列表
$ npm list --depth=0
├── babel-jest@18.0.0
├── babel-preset-react-native@1.9.1
├── invariant@2.2.2
├── jest@18.1.0
├── react@15.4.2
├── react-native@0.40.0
├── react-native-image-carousel@0.3.2
├── react-native-image-picker@0.25.7
├── react-native-local-mongodb@1.8.2
└── react-test-renderer@15.4.2
【问题讨论】:
标签: ios node.js react-native npm