React-native: React native - iphone - Error: Duplicated files or mocks

Created on 22 Jul 2019  路  23Comments  路  Source: facebook/react-native

hi all
i have build with new project with 0.60.3 when run on device ( with react-native run-ios --device)
already run:

  • pod install
    then i take result on screenshot bellow
    Please help me
    there are no 3rd pt lib, just UI
    image
Bug Ran Commands Stale

Most helpful comment

facebook/metro@f3c9862

Huge thanks for @xxsnakerxx above in this section 馃憦



Temporary solution but worked for me.
I've had this problem while building for ios.

Metro bundler copied the package.json into the ios/build folder.
That build folder was not created by xcode itself.

Solution (for ios building problems):

  1. Follow the link above, and edit the file (yeah i know, crappy way of doing something)
  2. 2.
cd ios/
rm -rf build/
xcodebuild clean
cd ..

Note, that xcode is going to warn you that the build folder was not created by it, if you did not deleted that beforehand.
3.

react-native run-ios

Cheers

All 23 comments


Thanks for submitting your issue. Can you take another look at your description and make sure the issue template has been filled in its entirety?

馃憠 Click here if you want to take another look at the Bug Report issue template.

this is happening to me since upgrading to 0.60.x and is extreemly frustrating. Seems like occasionally the builds will work after several cache cleans, pod deintegrates, and head banging against the wall.

The following files share their name; please adjust your hasteImpl:
   * <rootDir>/package.json
   * <rootDir>/ios/build/App/Build/Products/Release-iphonesimulator/App.app/assets/package.json

is this related to doing things like

import * as pkg from "package.json";

in my source code?

Any update on this?

My project 0.60.4 have same issue.

mockPath1: 'node_modules/react-native/package.json',
mockPath2: 'ios/bundle/assets/node_modules/react-native/package.json' }

error Duplicated files or mocks. Please check the console for more info. Run CLI with --verbose flag for more details.

I got this error as well, it is kinda randomly... just deleting the react-native folder from: ios/build/Build/Products/Debug-iphoneos/Donk.app/assets/node_modules/react-native, since this folder is built in runtime. It is a temporal fix. My guess is that is some configuration in xcode that is causing this conflict.

I got this error as well, it is kinda randomly... just deleting the react-native folder from: ios/build/Build/Products/Debug-iphoneos/Donk.app/assets/node_modules/react-native, since this folder is built in runtime. It is a temporal fix. My guess is that is some configuration in xcode that is causing this conflict.

still meeting above error, look like pod regenerate folder again

@kyniema4 if you are using rn 0.60 try adding this line in metro.config.js inside blacklist and make sure to rm -rf node_modules and npm install, also execute npm start --reset-cache

/assets\/node_modules\/.*/

In the worst scenario and absolutely not recomendaded you can comment a couples of lines in the file: node_modules/jest-haste-map/build/index.js

this line: 
const PACKAGE_JSON = _path().default.sep + 'package.json';

and this line needs to be replace:
if (
            _this3._options.skipPackageJson &&
            relativeFilePath.endsWith(PACKAGE_JSON)
          ) {
            continue;
          }
by
continue;

Hello, I've just made this account to answer this problem

For me the problem was that i copied node_modules for backup but it was in the same directory of the app, i resolved it by moving it out of the app source

I have the same issue for R.N version 0.60

I have the same issue for R.N version 0.60

I have the same issue on 0.60.5

@asos-gianlucacolucci did you solve it

@zhllucky been able to run after removing the internal package.json. thanks.

@asos-gianlucacolucci why do we need to remove it?

@asos-gianlucacolucci hi, my friend, I still have not solved this problem. and i dont know why we need remove package.json.

@zhllucky deleted, so sorry

Let's me reproducing the issue:

Step 1: We run build the on device iOS (It is working)
Step 2: We run build it again then it will show the error above

Thank you

I faced this issue on 60.5 ;;;

Error: Duplicated files or mocks. Please check the console for more info
    at setModule (/Users/user/Desktop/ReactNative/ReactNative/node_modules/jest-haste-map/build/index.js:620:17)
    at workerReply (/Users/user/Desktop/ReactNative/ReactNative/node_modules/jest-haste-map/build/index.js:691:9)
    at process.internalTickCallback (internal/process/next_tick.js:77:7)

Can anyone help me..??

Hi guys. I faced this issue when I installed RN following the Realm guide.

However, when I installed the RN following this link React Native CLI Quickstart, the RN ran successfully without this issue.

If your case is like me, try it this way!

facebook/metro@f3c9862

Huge thanks for @xxsnakerxx above in this section 馃憦



Temporary solution but worked for me.
I've had this problem while building for ios.

Metro bundler copied the package.json into the ios/build folder.
That build folder was not created by xcode itself.

Solution (for ios building problems):

  1. Follow the link above, and edit the file (yeah i know, crappy way of doing something)
  2. 2.
cd ios/
rm -rf build/
xcodebuild clean
cd ..

Note, that xcode is going to warn you that the build folder was not created by it, if you did not deleted that beforehand.
3.

react-native run-ios

Cheers

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

Was this page helpful?
0 / 5 - 0 ratings