React-native: [update error]Duplicate module name: TouchHistoryMath

Created on 4 May 2016  路  16Comments  路  Source: facebook/react-native

I update react-native to 0.24.1 and install the peer dependency react @latest(15.0.2) then run react-native upgrade and react-native run-android. and get the error as following:

Failed to build DependencyGraph: @providesModule naming collision:
Duplicate module name: TouchHistoryMath
Paths: /Users/Mervyn/CodingNet/playwithreactnative/node_modules/react/lib/TouchHistoryMath.js collides with /Users/Mervyn/CodingNet/playwithreactnative/node_modules/react-native/Libraries/vendor/react/browser/eventPlugins/TouchHistoryMath.js

This error is caused by a @providesModule declaration with the same name accross two different files.
Error: @providesModule naming collision:
Duplicate module name: TouchHistoryMath
Paths: /Users/Mervyn/CodingNet/playwithreactnative/node_modules/react/lib/TouchHistoryMath.js collides with /Users/Mervyn/CodingNet/playwithreactnative/node_modules/react-native/Libraries/vendor/react/browser/eventPlugins/TouchHistoryMath.js

This error is caused by a @providesModule declaration with the same name accross two different files.
at HasteMap._updateHasteMap (/Users/Mervyn/CodingNet/playwithreactnative/node_modules/node-haste/lib/DependencyGraph/HasteMap.js:160:15)
at /Users/Mervyn/CodingNet/playwithreactnative/node_modules/node-haste/lib/DependencyGraph/HasteMap.js:125:25
at run (/Users/Mervyn/CodingNet/playwithreactnative/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:89:22)
at /Users/Mervyn/CodingNet/playwithreactnative/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:102:28
at flush (/Users/Mervyn/CodingNet/playwithreactnative/node_modules/babel-polyfill/node_modules/core-js/modules/_microtask.js:18:9)
at _combinedTickCallback (node.js:370:9)
at process._tickCallback (node.js:401:11)
~
Process terminated. Press to close the window

and I solve it by downgrading react version as the tips of react-native's npm warn to 0.14.5.

I want to know the reason. Anybody meets the same situation?

Locked

Most helpful comment

npm start -- --reset-cache

All 16 comments

Probably you had two different React versions installed. So there was a naming collision.

@radko93 no, the same module is in both React and React Native and they're conflicting in the packager build.

<my app>/node_modules/react/lib/TouchHistoryMath.js collides with /node_modules/react-native/Libraries/vendor/react/browser/eventPlugins/

I'm also hitting this issue too:
"react": "^15.0.2",
"react-dom": "^15.0.2",
"react-native": "^0.24.1"

Failed to build DependencyGraph: @providesModule naming collision:
Duplicate module name: TouchHistoryMath
Paths: /Users/cneff/git/gx-reactnative-poc/node_modules/react/lib/TouchHistoryMath.js collides with /Users/cneff/git/gx-reactnative-poc/node_modules/react-native/Libraries/vendor/react/browser/eventPlugins/TouchHistoryMath.js

This error is caused by a @providesModule declaration with the same name accross two different files.
Error: @providesModule naming collision:
Duplicate module name: TouchHistoryMath
Paths: /Users/cneff/git/gx-reactnative-poc/node_modules/react/lib/TouchHistoryMath.js collides with /Users/cneff/git/gx-reactnative-poc/node_modules/react-native/Libraries/vendor/react/browser/eventPlugins/TouchHistoryMath.js

As a temporary fix, please refer to this comment: https://github.com/facebook/react-native/issues/7271#issuecomment-215375355.

Also please note that peerDependency on 0.24 is not 15.0.2 but 0.14... https://github.com/facebook/react-native/blob/0.24-stable/package.json#L129. 15.x is on the 0.26-rc.

That might be the issue confirming @radko93 comment as there were some files moving back and forth between React / React Native recently.

Same issue.

I get same issue

Same here

Same when trying to do npm link for local module development

I also get the same issue @0.31.0.
This error is caused by a @providesModule declaration with the same name accross two different files.
at HasteMap._updateHasteMap (/Users/chenwei/Project/eengoo_upgrade_27/eengoo.app.react/node_modules/react-native/node_modules/node-haste/lib/DependencyGraph/HasteMap.js:162:15)
at /Users/chenwei/Project/eengoo_upgrade_27/eengoo.app.react/node_modules/react-native/node_modules/node-haste/lib/DependencyGraph/HasteMap.js:127:25

don't know how to slove

Any fixes for this one?

+1

I make new react-native project and i do copy paste all source code and new project working fine.

I was getting errors like

Failed to build DependencyGraph: @providesModule naming collision:
Failed to build DependencyGraph: @providesModule naming collision:
Duplicate module name: accepts
Duplicate module name: accepts

I solved it by deleting npm's cache .npm and rerunning packager with --reset-cache

rm -rf ~/.npm

npm start -- --reset-cache

Sometimes errors like these can be fixed by wiping out node_modules and re-installing everything. Also by getting dependencies up to date.

I'm closing this for now because there are several workarounds for it, but I also think the packager team is working on making this more resilient.

git clone your code -> npm install -> react-native run-android

Was this page helpful?
0 / 5 - 0 ratings