Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jest-haste-map: Haste module naming collision: react-native when attempting to generate .ipa

I need to generate an .ipa of the different targets my project has, but whether I do it in command line or via Xcode I continue to get the following error:

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>/ios/build/Archive/DEV.xcarchive/Products/Applications/DEV.app/assets/node_modules/react-native/package.json

Failed to construct transformer:  { Error: Duplicated files or mocks. Please check the console for more info
    at setModule (/Users/danale/Projects/NFIBEngage/node_modules/jest-haste-map/build/index.js:620:17)
    at workerReply (/Users/danale/Projects/NFIBEngage/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:
   'ios/build/Archive/DEV.xcarchive/Products/Applications/DEV.app/assets/node_modules/react-native/package.json' }

I have already tried creating the rn-cli.config.js file like this:

const blacklist = require("metro-config/src/defaults/blacklist");

module.exports = {
  resolver: {
    blacklistRE: blacklist([/nodejs-assets\/.*/, /android\/.*/, /ios\/.*/])
  }
};

or this:

const blacklist = require("metro-config/src/defaults/blacklist");

module.exports = {
  resolver: {
    blacklistRE: blacklist([/node_modules\/.*\/node_modules\/react-native\/.*/])
  }
};

Neither of which has worked for me. I do also have a metro.config.js:

/**
 * Metro configuration for React Native
 * https://github.com/facebook/react-native
 *
 * @format
 */

module.exports = {
  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: false,
      },
    }),
  },
};

The steps here did not work for me:

How to fix React Native error "jest-haste-map: Haste module naming collision"?

Naming collision in react native app start

Error: jest-haste-map: Haste module naming collision:

I have tried running an rm -rf ios/build but eventually when it gets recreated the error returns.

like image 629
Daniel Avatar asked Sep 17 '19 06:09

Daniel


1 Answers

What worked was running the following command:

rm ios/build/Archive/DEV.xcarchive/Products/Applications/DEV.app/assets/node_modules/react-native/package.json
like image 97
Daniel Avatar answered Oct 13 '22 02:10

Daniel