skip to Main Content

Just make a new React Native projects on new Macbook M1. At first it was building on Xcode 12.4 with any troubles. But after a few days build failed with error:

fatal error: module map file ‘/Users/jocoders/Library/Developer/Xcode/DerivedData/CryptoWalletApp-hfiwvoyqlbgufkgtyvqtxygiaodf/Build/Products/Debug-iphonesimulator/YogaKit/YogaKit.modulemap’ not found

What I already tried, but nothing works from it:

  1. Checked cocoapods build target and it is the same version as my projects build target https://github.com/facebook/react-native/issues/28503#issuecomment-643744117
  2. Rebuild a project;
  3. Install pod with command arch -x86_64 pod install;
  4. Put arm64 in Xcode Excluded Architectures https://github.com/facebook/react-native/issues/28503#issuecomment-770378485.

Guys can you tell me please how to solve it? Is it possible now to develop for React Native on new Macbook M1? I have it already a few weeks, but still not work on IOS, because it is so painy, a lot of errors. And I was waiting more surprises from Android more then IOS, but in real Android works with out any troubles.

5

Answers


  1. Chosen as BEST ANSWER

    All day I tried to find the decision and nothing worked to me except it: please try to open Xcode through Rosetta - Right click on Xcode in applications folder -> Get Info -> set Open with Rosetta to true


  2. When you try to create a project using the below command in M1(Apple Silicon Chip):

    npx react-native init ProjectName
    

    Try to build using below steps:

    1. Open Terminal and install rosetta
    2. Type "softwareupdate — install-rosetta" command in your terminal.
    3. After installation completes, go to the Application.
    4. Find Terminal App
    5. Right click and make a Duplicate Terminal
    6. Now right click on a duplicate terminal and click on "Get Info"
    7. You will see checkbox with option "Open with Rosetta". Enable it. Rosetta checkbox in terminal
    8. That’s it. Rename your rosetta terminal so that you can identify it easily.
    9. Open your Rosetta Terminal and run the command npx react-native init ProjectName
    10. After project initialisation done type npx react-native start to start metro.
    11. Now type command npx react-native run-android for run into Android
    12. Type command npx react-native run-ios for run into iOS.
    13. After project initialisation is done you can run start and run command in VS Code also.
    Login or Signup to reply.
  3. I had the same issue although not on a M1. I fixed it using all the recommendations from this answer.

    Quoting the answer there for reference:

    Make sure your cocoapods build target is the same version as your
    projects build target.
    Try rebooting your machine.
    Examine your podfile to make sure your build scheme is included in it.

    The last thing that really helped me was rebooting the machine. Strange!

    Login or Signup to reply.
  4. I had this problem with react-native 0.70 and xcode 14.2, and i was able to eventually get the app to run by opening the .workspace (NOT the .project xcode file) xcode file in xcode and running (the "play" button in xcode) from the root directory.

    After this worked (the app succesfully ran in the ios simulator), i was able to run metro in the terminal and then run

    yarn react-native run-ios 
    

    from within the ios folder of the app.

    The app succesfully built and ran from terminal.

    Login or Signup to reply.
  5. I have got an M1 mac setup. The above methodologies were not working for me. However, this worked: Run XCode Rosetta

    Finder -> Xcode in applications folder -> Get Info -> set Open with
    Rosetta to true

    Xcode is now under Rosetta.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search