描述
在我的项目中,我正在使用"react-native": "0.36.0"
依赖项:
"lodash": "^4.15.0"
"yeoman-generator": "^0.24.1"
当使用高于"^3.10.1"
for"lodash"
和"0.21.2"
for 的版本时,我会在和运行打包程序时"yeoman-generator"
遇到命名冲突。"lodash"
"inquirer"
"cli-width"
再生产
具有上述依赖项并运行:react-native start --reset-cache
结果:
jest-haste-map: @providesModule naming collision:
Duplicate module name: inquirer
Paths: /CoolProject/node_modules/react-native/node_modules/yeoman-generator/node_modules/inquirer/package.json collides with /CoolProject/node_modules/react-native/node_modules/inquirer/package.json
This warning is caused by a @providesModule declaration with the same name across two different files.
jest-haste-map: @providesModule naming collision:
Duplicate module name: lodash
Paths: /CoolProject/node_modules/react-native/node_modules/lodash/package.json collides with /CoolProject/node_modules/react-native/node_modules/inquirer/node_modules/lodash/package.json
This warning is caused by a @providesModule declaration with the same name across two different files.
jest-haste-map: @providesModule naming collision:
Duplicate module name: cli-width
Paths: /CoolProject/node_modules/react-native/node_modules/yeoman-generator/node_modules/cli-width/package.json collides with /CoolProject/node_modules/react-native/node_modules/cli-width/package.json
This warning is caused by a @providesModule declaration with the same name across two different files.
解决方案
使用与for"lodash"
和for"yeoman-generator"
中使用的版本相同的版本可以解决问题,但目前对我来说确实不是一个选择,特别是因为它是另一个依赖项的依赖项。还有其他可能的解决方法吗?react-native@0.36.0
"^3.10.1"
"lodash"
"0.21.2"
"yeoman-generator"
"yeoman-generator"
谢谢!
更新
关于这个问题的更多细节可以在react-native
我发布的 Gihub 问题中找到:https ://github.com/facebook/react-native/issues/11200
更新 2
升级react-native
到 0.39 解决了这个问题。实际的修复似乎是删除明显未使用(并且可能已过时)的yeoman-generator
依赖项:https ://github.com/facebook/react-native/commit/1fd7a574ba538d05da4be841c84a70766464ec13