In my project I am using "react-native": "0.36.0"
and among the dependencies:
"lodash": "^4.15.0"
"yeoman-generator": "^0.24.1"
When using versions higher than "^3.10.1"
for "lodash"
and "0.21.2"
for "yeoman-generator"
I get naming collisions on "lodash"
, "inquirer"
and "cli-width"
when running packager.
Have the dependencies described above and run: react-native start --reset-cache
Result:
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.
Using the same versions for "lodash"
and "yeoman-generator"
as the ones used in react-native@0.36.0
(ie "^3.10.1"
for "lodash"
and "0.21.2"
for "yeoman-generator"
) fixes the issue, but changing them is really not an option for me at the moment, especially because "yeoman-generator"
is the dependency of another dependency. Is there any other possible fix?
Thanks!
More details about this issue can be found in the react-native
Gihub issue I posted: https://github.com/facebook/react-native/issues/11200
Upgrading react-native
to 0.39 solves the problem. The actual fix seems to be the removal of the apparently unused (and maybe outdated) yeoman-generator
dependency: https://github.com/facebook/react-native/commit/1fd7a574ba538d05da4be841c84a70766464ec13
This usually happens when you switch from npm
to yarn
when installing modules or setting up projects using React Native. A simple npm install
will usually close this issue without damaging your project's configuration.
npm install
will notify you some of your modules are either deprecated or set up on a different version from the React Native ones and do what it takes to fix it. Also, if you wish to really clean up your configuration, notice the npm WARN gentlyRm
warnings about packages that are put aside but not removed.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.