简体   繁体   中英

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.

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

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.

I had the same issue although not on a M1. I fixed it using all the recommendations from this answer . The last thing that really helped was rebooting the machine. Strange!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM