jc28
jc28

Reputation: 1882

YogaKit.modulemap not found in React Native on IOS after build in Xcode 12.4 on Macbook M1

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.

Upvotes: 1

Views: 12205

Answers (5)

abhiDagwar
abhiDagwar

Reputation: 189

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.

Upvotes: 1

Harshal
Harshal

Reputation: 8308

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.

Upvotes: 0

Edward S.
Edward S.

Reputation: 11

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.

Upvotes: 1

Rob Oter
Rob Oter

Reputation: 11

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!

Upvotes: 0

jc28
jc28

Reputation: 1882

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

Upvotes: 4

Related Questions