How to resolve the jest-haste-map error in react-native?

error: jest-haste-map: haste module naming collision: duplicate module name: react-native
the name: react-native was looked up in the haste module map it cannot be resolved
haste-map-react-native-packager
providesmodule react native
duplicate module name: react-native-vector-icons
npx react-native run-android
this error is caused by a @providesmodule declaration with the same name across two different files.
jest automock

Seen in my Metro Bundler console output:

Error: Cannot find module 'jest-haste-map'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (D:/Reat Native demo/kindbase-foodli-app-935bb0d21eae/

node_modules/react-native/packager/react-packager/src/node-haste/index.js:19:22)

I make a new project. But I run the react-native run-android and the issue still persists?

Try to uninstall react-native from node_module folder using command

npm uninstall react-native

and then re-install that module using command

npm install react-native

And run your app.

Error: jest-haste-map: @providesModule naming collision · Issue , Environment React Native Environment Info: System: OS: macOS High Sierra Error: jest-haste-map: @providesModule naming collision #21242 react-native-​bot added the Resolution: Locked label on Dec 11, 2019. Dismiss Join GitHub today. GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.

open the file rn-cli.config.js and change it to the following :)

const blacklist = require('metro-config/src/defaults/blacklist');
module.exports = {
  resolver: {
    blacklistRE: blacklist()
  }
};

jest-haste-map: Haste module naming collision: react , jest-haste-map: Haste module naming collision: react-native #169 This error originated either by throwing inside of an async function to "react-native": "0.61.​0-rc.0" for time being after no success resolving this issue. I run clone the repo on a completely new mac, and running react-native run-ios --simulator='iPhone X' fails with. Error: Cannot find module 'jest-haste-map' I actually tracked everything (Pods, lib, node_modules) to git to avoid these problems. To solve this, I run npm install jest-haste-map, then I get. Error: Cannot find module 'jest-worker'

I reported this on the GitHub repo https://github.com/facebook/react-native/issues/21146

I had to

rm -rf node_modules npm install

to make it work

Error: Cannot find module 'jest-haste-map' · Issue #21146 · facebook , jest-haste-map: Haste module naming collision: react-native #26397. Closed I still get the following error when running npm run android : jest-haste-map: Haste To be clear this does not resolve it, it eventually creates the  Error: Unable to resolve module `react-native-html-to-pdf` #79. Error: jest-haste-map: Haste module naming collision: Duplicate module name: react-animated

RN, Environment React Native Environment Info: System: OS: macOS High Sierra To solve this, I run npm install jest-haste-map , then I get. Error:  npm install jest-haste-map. Cannot find module 'jest-worker' npm install jest-worker 👍 1

React Native : Error: jest-haste-map: Haste module naming collision , It's related to react-native's usage of metro, where a plugin might need to The metro resolution logic (which is powered by jest-haste-map )  I still couldn't get it to work, even with updating the Podfile to reference node_modules and configuring metro.config.js with the blacklist.. It turns out my issue was that there was an unused React directory lying around within ios/Pods which was causing the conflict.

RN: Error: Cannot find module 'jest-haste-map' · Issue #360 , React Native : Error: jest-haste-map: Haste module naming collision, Duplicate module name: react-animated #5460. Closed. sharathm89  I'm going to explain why it's important and how you can use error boundaries in a React-Native application to improve error resiliency, so let's get into it! 👨‍💻

Comments
  • where can i find this file?
  • This worked for me, thank you Fareed!