react-native icon indicating copy to clipboard operation
react-native copied to clipboard

[update error]Duplicate module name: TouchHistoryMath

Open MervynFang opened this issue 10 years ago • 16 comments

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?

MervynFang avatar May 04 '16 13:05 MervynFang

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

radko93 avatar May 04 '16 14:05 radko93

@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/

calvinf avatar May 04 '16 15:05 calvinf

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

ineffably avatar May 04 '16 23:05 ineffably

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.

grabbou avatar May 05 '16 11:05 grabbou

Same issue.

Kim-Andersen avatar May 06 '16 19:05 Kim-Andersen

I get same issue

mvnnn avatar Jun 14 '16 06:06 mvnnn

Same here

Sherlock92 avatar Jun 24 '16 17:06 Sherlock92

Same when trying to do npm link for local module development

dominictobias avatar Jun 27 '16 14:06 dominictobias

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

tanpuer avatar Aug 24 '16 02:08 tanpuer

Any fixes for this one?

TheIndianRaj avatar Oct 10 '16 16:10 TheIndianRaj

+1

arstiefel avatar Oct 10 '16 21:10 arstiefel

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

mvnnn avatar Oct 12 '16 09:10 mvnnn

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

sghiassy avatar Oct 24 '16 21:10 sghiassy

npm start -- --reset-cache

tianwawawa avatar Feb 11 '17 08:02 tianwawawa

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.

ericvicenti avatar Mar 06 '17 06:03 ericvicenti

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

ze25800000 avatar Jun 25 '18 01:06 ze25800000