PhaseScriptExecution failed when trying to run React Native app - ios

I am a newcomer when it comes to React Native. However, when I tried to follow the steps that React Native provided: Environment Setup (I chose to use React Native CLI, Mac and iOS). Everything went fine until I tried to run the command
npx react-native run-ios
This is the error log that I received in the Terminal:
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/phillip/Library/Developer/Xcode/DerivedData/myproject-csoqwegnbwhthjczvzcjwqasamef/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-46EB2E00018F30.sh (in target 'FBReactNativeSpec' from project 'Pods')
(1 failure)
I am using a MacBook Air with
M1 chip
MacOS Monterey
Xcode Version 14.2
node v19.6.0
Metro v0.73.7
I searched for a bunch of solutions, including the node versions, nvm, uninstalling build folder and use pod install, commenting post_install function inside Podfile file, but nothing works so far. I am using Node v19.6.0 and this is my which node output: /Users/username/.nvm/versions/node/v19.6.0/bin/node.
I also tried solutions from this reference: React Native - FBReactNativeSpec Command PhaseScriptExecution failed with a nonzero exit code but nothing has worked
Any help would be appreciated, thank you.

Related

PhaseScriptExecution when trying to execute ionic cordova run ios

When I tried to build my application on IOS emulator, it shows the following error, I search online and I found it has something to do with Pod, but I didn't get any useful solutions for this.
The following build commands failed:
PhaseScriptExecution Copy\ www\ directory /Users/kai/Library/Developer/Xcode/DerivedData/RADAR_Questionnaire-ewiaqvtxwvvffzdyqzeazoxksrcm/Build/Intermediates.noindex/RADAR\ Questionnaire.build/Debug-iphonesimulator/RADAR\ Questionnaire.build/Script-304B58A110DAC018002A0835.sh (in target 'RADAR Questionnaire' from project 'RADAR Questionnaire')
(1 failure)
xcodebuild: Command failed with exit code 65
By the way, the app can build fine until I upgrade my mac from 11 (Big surf) -> 12 (Monetary ), I am not sure does it have something to do with the upgrade.

react-native build failing due to PhaseScriptExecution error

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

React Native run IOS build failure

I'm new to developing react native apps for iOS. I created a project using react-native init. I have managed to install all the requirements mentioned on that page. However, I ran into an issue while installing cocoa pods, but I installed it with home-brew. But now, I run into this build issue.
I have attached the issue which showed up in the terminal as well as the screenshot of the build error on Xcode. Any help would be appreciated. Thank you.
terminal build fail code
The following build commands failed:
CompileC /Users/ahyanawaz/Library/Developer/Xcode/DerivedData/Store-bekhqxqflgsqtyheijdxkrbwrksk/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Core.build/Objects-normal/x86_64/RCTDatePickerManager.o /Users/ahyanawaz/Desktop/Store/node_modules/react-native/React/Views/RCTDatePickerManager.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Xcode build time error
img01
img02

Xcode build fail on m1 chip

I'm trying to build a flutter app in Xcode on my Mac (m1 chip). But it fails due to below error.
Command PhaseScriptExecution failed with a nonzero exit code
As the warning says, my guess is that the issue occur while it trying to build it for arm64. But I have already add aram64 in excluded arch list.
I'm running Xcode on rosetta & also its build successfully on iOS 12 & iOS 14 simulators but the issue comes when I try to build it on real device with iOS 14.3 and also in archive build. What I'm doing wrong here?
Command PhaseScriptExecution failed with a nonzero exit code
The error you've encountered could be due to many reasons. It would be better if you can isolate the issue by performing the workaround that was discussed in this GitHub post.
Sent here from:
#76302
So I was having this issue after trying every flutter clean / podfile
delete sequence under the sun. Turns out my flutter got stuck at an
old version that is evidently not compatible with the latest version
of xcode or something (who really knows).
So I had to run
flutter upgrade --force
flutter clean
delete Podfile and Podfile.lock
run pub get
re-run my build_runner stuff (you may not have this)
flutter run (to run the app on device with all this new stuff / regenerate podfile stuff)
Then I was finally able to get my ios archive to build with flutter build ipa.
FYI: The flutter upgrade command pushed me from 2.0.5 -> 2.2.1 on
the stable channel. Prior to this, I was just getting generic warnings
of Command PhaseScriptExecution failed with a nonzero exit code.

Ionic build on iOS returns "BUILD FAILED"

I'm working on Ionic on a Mac machine. I have installed Google Analytics plugin and trying to build project but it is not working.
I am getting following error:
** **BUILD FAILED** **
The following build commands failed:
..../path normal i386
(1 failure)
>Error: Error code 65 for command: xcodebuild with args:
-xcconfig,/Volumes/Workspace/Dev/TestApp/platforms/ios/cordova/build-debug.xcconfig,
-project,TestApp.xcodeproj,
-target,TestApp,-configuration,Debug,-sdk,iphonesimulator,-destination,platform=iOS Simulator,build,CONFIGURATION_BUILD_DIR=/Volumes/Workspace/Dev/TestApp/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Volumes/Workspace/Dev/TestApp/platforms/ios/build/sharedpch
I have tried with platform removing and add adding but still not got fixed.
How can I solve this issue?
It was an issue due to xcode compatibility of plugin. uninstalling current xcode and installing xcode 7.3.1 solved issue.
Note: It is due to ionic build ios command internally uses xcode command to build project.

Resources