Solvedreact native router flux Duplicate versions of react-native being installed

react-native-router-flux v3.38.1
react-native v0.42.3

yarn install is causing react-native v0.42.3 and react-native v0.41.1 to be installed

Should react and react-native be installed as a peerDependency for react-native-router-flux?

To repro:

react-native init {projectName} --version=0.42.3
cd {projectName}
yarn add react-native-router-flux
npm start

You should see

Failed to build DependencyGraph: @providesModule naming collision:
  Duplicate module name: react-animated
  Paths: /Users/bdewitt/sandbox/break/node_modules/react-native-router-flux/node_modules/react-native/Libraries/Animated/release/package.json collides with /Users/bdewitt/sandbox/break/node_modules/react-native/Libraries/Animated/release/package.json

This error is caused by a @providesModule declaration with the same name across two different files.
Error: @providesModule naming collision:
  Duplicate module name: react-animated
  Paths: /Users/bdewitt/sandbox/break/node_modules/react-native-router-flux/node_modules/react-native/Libraries/Animated/release/package.json collides with /Users/bdewitt/sandbox/break/node_modules/react-native/Libraries/Animated/release/package.json

This error is caused by a @providesModule declaration with the same name across two different files.
    at HasteMap._updateHasteMap (/Users/bdewitt/sandbox/break/node_modules/react-native/packager/src/node-haste/DependencyGraph/HasteMap.js:158:13)
    at p.getName.then.name (/Users/bdewitt/sandbox/break/node_modules/react-native/packager/src/node-haste/DependencyGraph/HasteMap.js:133:31)

yarn add react-native-router-flux@3.38.0

Should succeed

41 Answers

✔️Accepted Answer

Got wrecked by this too. Fixed with the rollback to 3.38.0

watchman watch-del-all
rm -rf node_modules && npm install
npm uninstall react-native-router-flux
npm install --save react-native-router-flux@3.38.0
rm -fr $TMPDIR/react-*
npm cache clean
npm start -- --reset-cache

Other Answers:

reinstall 3.38.0 for now
npm install --save react-native-router-flux@3.38.0

Came here to post the same issue, looks like it was accidentally added to the dependencies in this commit: 34e2d7a

I believe It should be listed as a peerDependency instead

I've been tearing my hair out over this issue, glad to come across the root of the problem

jest-haste-map: @providesModule naming collision:
  Duplicate module name: react-native
  Paths: /Users/${username}/Desktop/${appName}/node_modules/react-native-router-flux/node_modules/react-native/package.json collides with /Users/${username}/Desktop/${appName}/node_modules/react-native/package.json

This warning is caused by a @providesModule declaration with the same name across two different files.
Failed to build DependencyGraph: @providesModule naming collision:
  Duplicate module name: react-native-vector-icons
  Paths: /Users/${username}/Desktop/${appName}/node_modules/react-native/local-cli/core/__fixtures__/files/package.json collides with /Users/${username}/Desktop/${appName}/node_modules/react-native-router-flux/node_modules/react-native/local-cli/core/__fixtures__/files/package.json

This error is caused by a @providesModule declaration with the same name across two different files.
Error: @providesModule naming collision:
  Duplicate module name: react-native-vector-icons
  Paths: /Users/${username}/Desktop/${appName}/node_modules/react-native/local-cli/core/__fixtures__/files/package.json collides with /Users/${username}/Desktop/${appName}/node_modules/react-native-router-flux/node_modules/react-native/local-cli/core/__fixtures__/files/package.json

This error is caused by a @providesModule declaration with the same name across two different files.
    at HasteMap._updateHasteMap (/Users/${username}/Desktop/${appName}/node_modules/react-native/packager/src/node-haste/DependencyGraph/HasteMap.js:158:13)
    at p.getName.then.name (/Users/${username}/Desktop/${appName}/node_modules/react-native/packager/src/node-haste/DependencyGraph/HasteMap.js:133:31)

Removing react-native-router-flux from my package.json and reinstalling node_modules causes no errors so it's definitely react-native-router-flux.

yeah this has been destroying my day as well. as a quick work around, you can just go delete the dupe of react-native out of the node_modules folder within react-native-router-flux. Ugly, but will at least get you up and running for the time being