There is an odd error when npx react-native run-ios
for React Native 0.70.1/Xcode 14/Monterey M1:
The following build commands failed:
SwiftEmitModule normal arm64 Emitting module for YogaKit (in target 'YogaKit' from project 'Pods')
However build in Xcode 14 went successfully without any error. Tried to exclude arm64 in Build Setting for DEBUG (currently is i386) and it didn’t fix. Also add the following block in pod file and didn’t fix as well:
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
# some older pods don't support some architectures, anything over iOS 11 resolves that
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
end
end
3
Answers
Check Xcode config for PROJECT and Pods:
Or check directly the
project.pbxproj
file, you should have something like this for release or debug project configs:and for Pods:
Having this config should allow Intel x86_64 based builds for simulators to avoid that error.
My
Podfile
has also that setting:Notes:
X86_64
architectures. Please observe it targets only the simulators to exclude some unsupported libraries for current architecture. For M1 you need to check what are the architectures to be excluded and adjust Xcode and/or Podfile settings accordingly.You could also use some code to detect current architecture and exclude the ones that are not supported:
Source of above
Podfile
code:https://www.reddit.com/r/swift/comments/mw8djk/comment/gvi1rzh
When I had this issue I could still build in xcode itself but not with
npx react-native run-ios
in the terminal. What did it for me was to reboot my macbook m1.If you have such an issue try to comment all
"EXCLUDED_ARCHS"
lines of code in yourproject.pbxproj
.This helped me.