Reputation: 5150
When I install a specific npm package to my react native project and attempt to run it i get the following error:
This error is caused by a @providesModule declaration with the same name accross two different files.
Error: @providesModule naming collision:
Duplicate module name: promiseRejectionIsError
Paths:
projectname/node_modules/react-native-stripe-api/node_modules/react-native/Libraries/promiseRejectionIsError.js collides with
projectname/node_modules/react-native/Libraries/promiseRejectionIsError.js
Problem: This package react-native-stripe-api
seems to be installing another react and react-native module which conflict with the over all project modules.
I think the reason for this is because a specific version of react and react-native modules are defined as a dependency in the react-native-stripe-api/package.json:
"dependencies": {
"babel-polyfill": "6.9.1",
"react": "15.1.0",
"react-native": "0.27.2"
},
It seems like these should be removed.
Could someone with more knowledge about npm confirm this is actually the correct way of defining node dependencies. And the appropriate solution to resolve the problem.
Upvotes: 5
Views: 3107
Reputation: 1
You should remove the node_modules
folder, and then execute npm cache clean
, make sure there is no temp cache files or folder (like react-native-packager-cache-81b2c446
etc.) under your project root folder, and then re-execute npm install
Upvotes: 0
Reputation: 11992
Your assessment is correct
Could someone with more knowledge about npm confirm this is actually the correct way of defining node dependencies.
They should reference react
as a peerDependencies
And the appropriate solution to resolve the problem.
Quickfix: Delete the extra react version
Longfix: Submit a pull request with react as a peer dependency
Upvotes: 6