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:
- 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
- Rebuild a project;
- Install pod with command arch -x86_64 pod install;
- 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
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):
Try to build using below steps:
softwareupdate — install-rosetta
" command in your terminal.npx react-native init ProjectName
npx react-native start to start
metro.npx react-native run-android
for run into Androidnpx react-native run-ios
for run into iOS.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:
The last thing that really helped me 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
from within the ios folder of the app.
The app succesfully built and ran from terminal.
I have got an M1 mac setup. The above methodologies were not working for me. However, this worked: Run XCode Rosetta
Xcode is now under Rosetta.