Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native 0.64 Command PhaseScriptExecution failed with a nonzero exit code

I'm installing a new project with a bunch of modules with React Native 0.64. I can do a pod install without troubles, but when I want to make my app running (with react-native run-ios or with XCode) this error occured on XCode :

/Users/thomas/Desktop/Dev/Mobile/appname/node_modules/react-native/scripts/generate-specs.sh: line 27: readlink: command not found
/Users/thomas/Desktop/Dev/Mobile/appname/node_modules/react-native/scripts/generate-specs.sh: line 27: dirname: command not found
/Users/thomas/Desktop/Dev/Mobile/appname/node_modules/react-native/scripts/generate-specs.sh: line 27: cd: : No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code

This one on react-native run-ios :

The following build commands failed:
    PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/thomas/Library/Developer/Xcode/DerivedData/appname-aqbmfgqjkshyqmaprdvggqaeqjrp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/**FBReactNativeSpec**.build/Script-A319AA7F2B7AAE771AE63D66A0049241.sh

Note that I don't have a 'scripts' folder in my node_modules/react-native (I just have assets, normalize-color and polyfills folders). I've tried to remove node-modules and reinstall it.

My specs are :

iOS Big Sur v. 11.2.3

XCode v.12.3

React Native v.0.64

CocoaPods v. 1.10.1

Node v. 12.14.1

Any help ? Thanks.

like image 437
TheDans Avatar asked Apr 20 '21 09:04

TheDans


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.


2 Answers

The above answer is correct but in that case, you are editing the inside the node modules. So rather than just enter this command in your terminal

export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin
like image 59
user18188344 Avatar answered Oct 22 '22 06:10

user18188344


I found the solution after hours of debugging you need to modify this file for now.

  1. Edit this file /node_modules/react-native/React/FBReactNativeSpec/../../scripts/generate-specs.sh
  2. Add this line export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin
  3. Then run the project using Xcode it will work 100%
like image 4
Khanakia Avatar answered Oct 22 '22 05:10

Khanakia