Recently upgraded to node 18 and use node 18 in the pipeline.
Running
npx react-native run-ios --configuration Release --verbose
fails with the following error.
Worth noting, I'm using zsh locally but in pipeline it seems to pick run bash.
debug Reading /Users/runner/work/1/s/ios/Podfile
debug Reading /Users/runner/work/1/s/ios/Podfile.lock
info Found Xcode workspace "Myapp.xcworkspace"
info Launching iPhone 13 (iOS 15.2)
info Building (using "xcodebuild -workspace Myapp.xcworkspace -configuration Release -scheme Myapp -destination id=D82A8073-48E0-404F-9A66-2D4EE2EDEFC7")
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 Myapp.xcworkspace.
##[debug]Exit code 1 received from tool '/bin/bash'
##[debug]STDIO streams have closed for tool '/bin/bash'
##[error]Bash exited with code '1'.
##[debug]Processed: ##vso[task.issue type=error;]Bash exited with code '1'.
##[debug]task result: Failed
##[debug]Processed: ##vso[task.complete result=Failed;done=true;]
Finishing: iOS Build
You can periodically clean DerivedData folder with the following command:
rm -rf ~/Library/Developer/Xcode/DerivedData
And run your command again to check if the issue could be resolved.
npx react-native run-ios --configuration Release --verbose
Related
Environment
Mac OS X Version 12.1 (Apple M1 chip)
Xcode Version 13.2.1
Simulator Version 13.2 (972.2)
react-native-cli 7.0.3
node v18.4.0
The Issue
This is my first time working on developing an app using React Native. I am trying to run my React Native project on Xcode's simulator, using npx react-native run-ios. However, I am encountering this error message.
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 MCompass.xcworkspace.
Command line invocation:
/Users/brx/Downloads/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace MCompass.xcworkspace -configuration Debug -scheme MCompass -destination id=DC3C75E6-19FD-4B80-87B1-62BF6404ED20
...
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution Bundle\ React\ Native\ code\ and\ images /Users/brx/src/projects/test/MCompass/ios/build/MCompass.build/Debug-iphonesimulator/MCompass.build/Script-00DD1BFF1BD5951E006B06BC.sh (in target 'MCompass' from project 'MCompass')
(1 failure)
Between the first error message and ** BUILD FAILED **, there were many lines of output listing exports.
I've installed dependencies using both yarn and npm. I've also looked at several other threads with this same issue, but none of the solutions (such as having only one version of nvm or running react-native upgrade) have been successful. Does anyone have any tips?
I had my root folder name "REACT NATIVE", changing it to "REACT_NATIVE" fixed the error as the folder that contains your react native project cannot contain white spaces.
The second solution would be running Xcode with rosetta. This is only applicable for M1 chip macbooks as there are few times Xcode projects fail because of this reason. Please refer to below link for reference:
https://penny-huang.medium.com/xcode-how-to-run-ios-simulator-on-m1-mac-66101b9fccd8
I created my first react-native project and I started metro just fine. But When I try to run IOS it fails to build. Any suggestions on what I should check?
latest Xcode installed
karar#Karars-MacBook-Air TheGlobalDoctor % npx react-native run-ios
info Found Xcode workspace "TheGlobalDoctor.xcworkspace"
info Building (using "xcodebuild -workspace TheGlobalDoctor.xcworkspace -configuration Debug -scheme TheGlobalDoctor -destination id=845FA08B-2299-4B05-B9C9-207405392A77")
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 TheGlobalDoctor.xcworkspace.
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace TheGlobalDoctor.xcworkspace -configuration Debug -scheme TheGlobalDoctor -destination id=845FA08B-2299-4B05-B9C9-207405392A77
Xcode Failed Build error:
fatal error: module map file '/Users/karar/Library/Developer/Xcode/DerivedData/TheGlobalDoctor-axdadhlgtbbtzcabxyzzteupuwlt/Build/Products/Debug-iphonesimulator/YogaKit/YogaKit.modulemap' not found 1 error generated.
I had a similar issue. You can start XCode using Rosetta to circumvent the problem for now.
To do so open 'Applications' and find XCode. Open it's context menu and select 'Get Info'. In the info view, make sure the "Open using Rosetta" checkbox is checked.
(Thx to Karthik posting the solution in his blog)
after updating MacOS to Big Sur and since Legacy build is deprecated
react-native run-ios does not work anymore, I've tried so many solutions but no progress I've been suffering with this for around 3 days.
side note that build on xcode succeeded
versions:
react-native: 0.59.10
xcode: 12
and I'm using iPhone 11 simulator and I also tried a real iPhone 11 device
result of npx react-native run-ios
on simulator:
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 myapp.xcworkspace
** BUILD FAILED **
The following build commands failed:
Ld /myapp/ios/build/Build/Products/Debug-iphonesimulator/myapp.app/PlugIns/myapp.xctest/myapp normal
(1 failure)
another one on the simulator:
info ** BUILD SUCCEEDED **
info Installing DerivedData/Build/Products/Debug-iphonesimulator/myapp.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
error Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier DerivedData/Build/Products/Debug-iphonesimulator/myapp.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
on device:
info ** BUILD SUCCEEDED **
info installing and launching your app on Menna’s iPhone...
info ** INSTALLATION SUCCEEDED **
but the application doesn't appear on the device and I don't know how is that even possible?!
any help would be appreciated
SOLVED
in xcode, go to Project Settings > change build system to new build system
click on Advanced, then choose Custom (Relative to workspace) and specify locations as following:
Products: build/Build/Products
Intermediates: build/Build/Intermediates.noindex
in vs code, open node_modules/#react-native-community/cli/build/commands/runIOS/runIOS.js
and change DerivedData/Build/Products/${configuration}-${device}/${appName}.app
to build/Build/Products/${configuration}-${device}/${appName}.app;
delete ios/build and DerivedData content
run react-native run-ios again
try:
sudo npm install -g ios-deploy --unsafe-perm
and next:
yarn ios --device "YOUR_DEVICE_NAME"
I tried to build a simple reactNative app for ios using CLI and xcode.
Both builds fails with a different error.
Prior to both builds, I ran the following
npm install
pod install
Build using CLI
The steps are:
npx react-native run-ios
Having done so I found some errors on the log file which I am attaching
manish.basdeo#AMAC02SNHPHFVH3 Top100 % npx react-native run-ios
info Found Xcode workspace "Top100.xcworkspace"
info Launching iPhone 11 (iOS 13.3)
info Building (using "xcodebuild -workspace Top100.xcworkspace -configuration Debug -scheme Top100 -destination id=37E2E23C-60E2-42D4-8053-525A907ED979")
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 Top100.xcworkspace. Run CLI with --verbose flag for more details.
Build settings from command line:
TOOLCHAINS = com.apple.dt.toolchain.XcodeDefault
Prepare build
note: Using legacy build system
<unknown>:0: error: no such file or directory: '/Users/manish.basdeo/Desktop/Top100/Top100/ios/Pods/#/Users/manish.basdeo/Library/Developer/Xcode/DerivedData/Top100-etyxtwwnmplrdtdxgkmuhxstoudh/Build/Intermediates.noindex/Top100.build/Debug-iphonesimulator/Top100.build/Objects-normal/x86_64/Top100.SwiftFileList'
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
** BUILD FAILED **
The following build commands failed:
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(1 failure)
2) Build using XCODE
How can I fix both errors?
I first started my project with Expo and ejected it. Now, I'm trying to run the command react-native run-ios and it comes back with this error:
CoreData: annotation: Failed to load optimized model at path '/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/Frameworks/InstrumentsPackaging.framework/Versions/A/Resources/XRPackageModel.momd/XRPackageModel 9.0.omo'
Then it gives another error:
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 blahblahblah.xcworkspace
$ react-native run-ios
info Found Xcode workspace blahblahblah.xcworkspace
CoreData: annotation: Failed to load optimized model at path '/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/Frameworks/InstrumentsPackaging.framework/Versions/A/Resources/XRPackageModel.momd/XRPackageModel 9.0.omo'
info Launching iPhone X (iOS 12.2)...
info Building using "xcodebuild -workspace blahblahblah.xcworkspace -configuration Debug -scheme weather -destination id=E05006E8-DEB3-4317-967B-40759D275997 -derivedDataPath build/weather"
info User defaults from command line:
info IDEDerivedDataPathOverride = /Users/blahblahblah/Desktop/blahblahblah/ios/build/blahblahblah
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 blahblahblah.xcworkspace
Any help would be greatly appreciated!
Thank you!
use this.
react-native run-ios --simulator="iPhone 8"
This issue:
https://github.com/react-native-community/cli/pull/414
was fixed on #react-native-community/cli v1.9.8:
https://github.com/react-native-community/cli/releases/tag/v1.9.8
A bump in your yarn.lock to some version over 1.9.8 should fix it.