question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

jest-haste-map: Haste module naming collision: react-native

See original GitHub issue

Current behavior

jest-haste-map: Haste module naming collision: react-native
  The following files share their name; please adjust your hasteImpl:
    * <rootDir>/node_modules/react-native/package.json
    * <rootDir>/../../node_modules/@react-native-community/async-storage/node_modules/react-native/package.json

Failed to construct transformer:  { Error: Duplicated files or mocks. Please check the console for more info
    at setModule (app/packages/app/node_modules/jest-haste-map/build/index.js:620:17)
    at workerReply (app/packages/app/node_modules/jest-haste-map/build/index.js:691:9)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  mockPath1: 'node_modules/react-native/package.json',
  mockPath2:
   '../../node_modules/@react-native-community/async-storage/node_modules/react-native/package.json' }
(node:29889) UnhandledPromiseRejectionWarning: Error: Duplicated files or mocks. Please check the console for more info
    at setModule (app/packages/app/node_modules/jest-haste-map/build/index.js:620:17)
    at workerReply (app/packages/app/node_modules/jest-haste-map/build/index.js:691:9)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Expected behavior

It should not duplicate haste

Repro steps

“react-native”: “0.60.4”, “@react-native-community/async-storage”: “1.5.1”,

on a monorepo setup

Install

Environment

  • Async Storage version: “1.5.1”,
  • React-Native version: “0.60.4”,
  • Platform tested: android
  • Logs/Error that are relevant:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:46
  • Comments:56 (5 by maintainers)

github_iconTop GitHub Comments

34reactions
edgarclerigocommented, Aug 21, 2019

I was having the same issue, I have created a backup folder called node_modules_backup as a backup since I has going to remove the node_modules to install all the modules again, after I removed the node_modules_backup folder, the problem stoped and everything starts to run fine.

25reactions
gkdgcommented, Jun 25, 2020

for those who use AWS Amplify and having duplicated file error from jest-haste-map you can ignore the package.json file inside the #current-cloud-backend folder by adding below code inside metro.config.js file:

module.exports = {
  resolver: {
  blacklistRE: /#current-cloud-backend/
  }
};
Read more comments on GitHub >

github_iconTop Results From Across the Web

jest-haste-map: Haste module naming collision #8114 - GitHub
I have three different packages that all require a specific version of same dependency, but those versions are all different. This situation ...
Read more >
Error: jest-haste-map: Haste module naming collision
The error you get indicates that you have two react-native dependencies. One in your main project, one in your xxx module, thus creating...
Read more >
Jest-haste-map: Haste module naming collision
Previously i installed react native CLI , which i just uninstall then this issue is solved! remove your old react native global CLI....
Read more >
Update name in package.json [#3307971] | Drupal.org
Problem/Motivation The package.json is using gin as the package name, Seeing some warnings in CI: jest-haste-map: Haste module naming ...
Read more >
jest-haste-map: Haste module naming collision (AWS, RN)
Coding example for the question jest-haste-map: Haste module naming collision (AWS, RN)-React Native.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found