Reputation: 1882
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:
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
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:
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.Upvotes: 1
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
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
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
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