[英]React Native naming collision error when running packager, caused by “lodash” and “yeoman-generator”
在我的项目中,我使用"react-native": "0.36.0"
和依赖项之间:
"lodash": "^4.15.0"
"yeoman-generator": "^0.24.1"
当使用高于"^3.10.1"
版本用于"lodash"
和"0.21.2"
用于"yeoman-generator"
我在运行打包器时在"lodash"
, "inquirer"
"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"
中所使用的那些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
将react-native
升级到0.39解决了这个问题。 实际修复似乎是删除了显然未使用的(也许是过时的) yeoman-generator
依赖项: https : //github.com/facebook/react-native/commit/1fd7a574ba538d05da4be841c84a70766464ec13
当您在安装模块或使用React Native设置项目时从npm
切换到yarn
时,通常会发生这种情况。 简单的npm install
通常会关闭此问题而不会损坏项目的配置。
npm install
将通知您某些模块已弃用或与React Native不同的版本设置,并执行修复它所需的操作。 此外,如果您希望真正清理配置,请注意npm WARN gentlyRm
警告有关已放弃但未删除的包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.