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

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 <enter> 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?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 15
  • Comments: 16 (3 by maintainers)

Most upvoted comments

npm start – --reset-cache

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

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