I initialized new react-native project with "react-native init ReactNStudy" for first time on my M1 Silicon Apple computer.
Metro builder worked without any problems.
When building step I get very log error. Starting part of the error like that:
info Found Xcode workspace "ReactNCalisma.xcworkspace" info Launching iPhone 12 (iOS 14.4) info Building (using "xcodebuild -workspace ReactNCalisma.xcworkspace -configuration Debug -scheme ReactNCalisma
-destination id=E914C899-172A-45AE-AFB6-BEBA505887E1") (node:25639) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency (Use `node --trace-warnings ...` to show where the warning was created) error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening ReactNCalisma.xcworkspace. Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace ReactNCalisma.xcworkspace -configuration Debug -scheme ReactNCalisma -destination id=E914C899-172A-45AE-AFB6-BEBA505887E1
And ending part of the error like that:
objc[25723]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1fc2be7a0) and ?? (0x1189b42b8). One of the two will be used. Which one is undefined.
objc[25723]: Class AMSupportURLSession is implemented in both ?? (0x1fc2be7f0) and ?? (0x1189b4308). One of the two will be used. Which one is undefined.
** BUILD FAILED **
The following build commands failed:
Ld /Users/USERNAME/Library/Developer/Xcode/DerivedData/ReactNCalisma-anxlznepgpgzoyfpokskqpwmffzt/Build/Products/Debug-iphonesimulator/ReactNCalisma.app/ReactNCalisma normal
(1 failure)
info Run CLI with --verbose flag for more details.
After that I tried to run with "xcodebuild":
cd ios && xcodebuild
But in this part I get error as:
fatal error: module map file
'/Users/USERNAME/Desktop/Projects/ReactNCalisma/ios/build/Release-iphoneos/YogaKit/YogaKit.modulemap'
not found
** BUILD FAILED **
The following build commands failed:
CompileC /Users/USERNAME/Desktop/Projects/ReactNCalisma/ios/build/ReactNCalisma.build/Release-iphoneos/ReactNCalisma.build/Objects-normal/arm64/ReactNCalisma_vers.o /Users/USERNAME/Desktop/Projects/ReactNCalisma/ios/build/ReactNCalisma.build/Release-iphoneos/ReactNCalisma.build/DerivedSources/ReactNCalisma_vers.c normal arm64 c com.apple.compilers.llvm.clang.1_0.compiler
CompileC /Users/USERNAME/Desktop/Projects/ReactNCalisma/ios/build/ReactNCalisma.build/Release-iphoneos/ReactNCalisma.build/Objects-normal/armv7/ReactNCalisma_vers.o /Users/USERNAME/Desktop/Projects/ReactNCalisma/ios/build/ReactNCalisma.build/Release-iphoneos/ReactNCalisma.build/DerivedSources/ReactNCalisma_vers.c normal armv7 c com.apple.compilers.llvm.clang.1_0.compiler
(2 failures)
I tried to solve with Pod delete and reinstall, I checked my Xcode terminal settings but I cannot solve this problem .
Is this problem about M1? How can I solve this?
4
Answers
I followed those steps on macbook M1 (problem with cocoapoda and build):
1- Using Terminal with Rosetta (Make sure all terminals are closed):
Go Finder –> Applications –> Utilities –> Terminal (Then right click on Get Info – check Open using Rosetta)
Now you can open Terminal & install Cocoapoda from terminal
2- Use Xcode with Rosetta (Make sure that Xcode is closed):
Go Finder –> Application –> Xcode (Then right click on Get Info – check Open using Rosetta)
Now Xcode/simulator will work as Rosetta
3- Comment this part in Podfile (in ios folder)
Then reinstall pod:
Check this video:
https://youtu.be/UrxM1SyAXAE
I also experienced same issue before. But, Now i can compile and build react native run-ios sucessfully.
I already resume and create guide article on how to run react native iOS Macbook with M1 Chip.
Quick step:
full guide follow from this : https://handi.dev/blog/how-run-react-native-on-macbook-m1-apple-silicon
I had same problem. I fixed as below
If you didn´t find the answer yet:
I had the same issue and fixed it by downgrading my node.js version.