阵营本地运行打包时,所造成的“lodash”和“自耕农发电机”
说明
在我的项目,我使用"react-native": "0.36.0"
和依赖关系间的命名冲突错误:阵营本地运行打包时,所造成的“lodash”和“自耕农发电机”
"lodash": "^4.15.0"
"yeoman-generator": "^0.24.1"
当使用高于"^3.10.1"
的版本用于"lodash"
和"0.21.2"
对于"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.
解
使用对"lodash"
和"yeoman-generator"
相同版本作为[email protected]
使用的那些(即"^3.10.1"
为"lodash"
和"0.21.2"
为"yeoman-generator"
)修复了这个问题,但改变它们现在对我来说真的不是一种选择,尤其是因为"yeoman-generator"
是另一个依赖关系的依赖关系。 有没有其他可能的解决办法?
谢谢! https://github.com/facebook/react-native/issues/11200
更新2
升级react-native
0.39解决了这个问题:
更新
更多有关细节问题可以在react-native
Gihub问题我张贴找到。实际的修复似乎是去除显然未使用的(也许是过时的)yeoman-generator
依赖:https://github.com/facebook/react-native/commit/1fd7a574ba538d05da4be841c84a70766464ec13
当你安装的模块或使用阵营本地设置项目的切换时从npm
到yarn
这通常发生。一个简单的npm install
通常会关闭此问题而不会损坏您的项目配置。
npm install
会通知您一些您的模块已被弃用或在与React Native不同的版本上设置,并执行修复它的操作。另外,如果您希望真正清理配置,请注意npm WARN gentlyRm
关于已放置但未移除的软件包的警告。
你使用的是什么版本的npm? –
npm v3.10.8和节点v7.0.0 –