Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PhaseScriptExecution error in React Native app

Facing this error when I run react-native run-ios after creating the project

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 BoltAssignment.xcworkspace.
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace BoltAssignment.xcworkspace -configuration Debug -scheme BoltAssignment -destination id=3E598855-6D4F-4F36-BEE1-8663A1F71787


nvm is not compatible with the "PREFIX" environment variable: currently set to "/usr/local"
Run `unset PREFIX` to unset it.
nvm is not compatible with the "PREFIX" environment variable: currently set to "/usr/local"
Run `unset PREFIX` to unset it.
Command PhaseScriptExecution failed with a nonzero exit code

warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flipper-Glog' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.4, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flipper-PeerTalk' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'libwebp' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'YogaKit' from project 'Pods')
warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the BoltAssignment editor. (in target 'BoltAssignment' from project 'BoltAssignment')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flipper-DoubleConversion' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'boost-for-react-native' from project 'Pods')
warning: no rule to process file '/Users/harsh_nagalla/dev/BoltAssignment/ios/Pods/Flipper-RSocket/rsocket/README.md' of type 'net.daringfireball.markdown' for architecture 'x86_64' (in target 'Flipper-RSocket' from project 'Pods')
warning: no rule to process file '/Users/harsh_nagalla/dev/BoltAssignment/ios/Pods/Flipper-RSocket/rsocket/benchmarks/CMakeLists.txt' of type 'text' for architecture 'x86_64' (in target 'Flipper-RSocket' from project 'Pods')
warning: no rule to process file '/Users/harsh_nagalla/dev/BoltAssignment/ios/Pods/Flipper-RSocket/rsocket/benchmarks/README.md' of type 'net.daringfireball.markdown' for architecture 'x86_64' (in target 'Flipper-RSocket' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'RNFastImage' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'SDWebImageWebPCoder' from project 'Pods')

** BUILD FAILED **


The following build commands failed:
    PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/harsh_nagalla/Library/Developer/Xcode/DerivedData/BoltAssignment-cxeqsscopunscndrzxcrfnugkasb/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-1F0D93C9412E4439D9C46216EB143B15.sh
(1 failure)

Steps followed-

  1. yarn install
  2. start metro server
  3. cd ios -> pod install
  4. npx react-native run-ios

Pretty new to react native so I am totally clueless why this is happening. It would be much appreciated if someone can help with this.

If you have faced the same issue and still clueless like me then please share and upvote so it reaches to as many people as possible.

like image 411
Harsh Nagalla Avatar asked Mar 14 '21 17:03

Harsh Nagalla


People also ask

What is react native codegen?

ReactNativeCodeGen takes a flowtype type definition of the props a React Native component expects and generates java and swift code to marshall the data, including functions and structs. The resulting class is then usable within the context of a typical iOS or Android app.

Does react-native run-iOS throw phasescriptexecution error?

For me and RN 0.64/Apple M1, running react-native run-ios threw the PhaseScriptExecution error. However, running npx react-native run-ios works as intended. I had this issue when starting the build with yarn - and was able to build the app only by using xcode or react-native run-ios.

Why can't I run a React Native project from a folder?

The problem is because you have the project created inside a folder with a name that contains spaces, example: "React Native", rename your folder to "React-Native" and rerun the command npx react-native run-ios, that should be enough.

Why do my React Native builds fail in Xcode?

If your React Native builds fail in Xcode with the following message: one possible reason could be that Xcode is using an outdated version of Node (in my case, it was because I use nvm to manage my Node versions, but Xcode used an old version of Node that I had installed via HomeBrew a long time ago).

How do I upgrade react native to the latest version?

Move the project folder in a path with no spaces (i.e. ~/sub folder name/ReactNativeApp won't work till you have spaces in the path, so move in a path like ~/folder/ReactNativeApp) Then cd into the project folder and upgrade react native to the latest version with npx react-native upgrade and resolve conflicts if any


2 Answers

I have figured out a solution, if you're using nvm make sure you don't have another globally installed version of Node/npm.

If you aren't sure whether or not you have a global version, go to your bash_profile/zshrc and comment the three nvm initialization lines (export NVM_DIR="$HOME/.nvm" [...]), then open a new terminal and do node --version, if it still finds something it means that you have a global version somewhere, and you can find its path with which node.

In my case I'm using Homebrew, and I had a global version of Node that I wasn't even aware coming from the yarn formula, I discovered it after running brew uses --installed node. I went ahead and uninstalled yarn using brew uninstall --force yarn, which automatically uninstalled its node/npm dependency, then uncommented the nvm initialization lines, and then I reinstalled yarn using nvm's npm with npm i -g yarn, and now everything works.

like image 79
Edmundo Rodrigues Avatar answered Oct 11 '22 17:10

Edmundo Rodrigues


The only solution that worked for me currently (RN v0.64.0), till this issue root cause properly identified (seems related to nvm though!) is to go to your /node_modules/react-native/scripts/find-node.sh and set these two lines on top.

You can use patch-package to keep those changes permanent.

unset npm_config_prefix
unset PREFIX
like image 16
Solly Avatar answered Oct 11 '22 15:10

Solly