I am trying to build my React Native project on Xcode and it is failing. The build target is react-native-config with the error: Run custom shell script ‘[CP-User] Config codegen’ "Command PhaseScriptExecution failed with a nonzero exit code".
Trying to run it with –verbose, I get the following:
The following build commands failed: PhaseScriptExecution [CP-User] Config codegen /User/userName/Library/Developer/Xcode/DerivedData/projectName/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-config-build/Script-21BEEA33BD6A21BF27B73D38DC1AD4.sh
I am running React Native 0.63.1 with React-Native-Config 1.4.1 and I have tried reinstalling node_modules, pods, deleting DerivedData and cleaning the build but no luck. I also do not see any references to react-native-config under Build Phases > Run Script.
Any ideas how to solve this?
6
Answers
Usually, this is caused by a badly formatted
.env
file. Double-check your.env
.I had the same Problem, I followed a tutorial to build ios, it is pretty old (one year) in tutorial I added code which include some thing like
please delete it from podfile and follow the doc of react-native-config to use environment variables here
after delete dont forget pod install
while building take care of build scheme (which one are you using while build time)
Usually this problem when a dependency is not updated.
You can try the following steps:
If anyone is facing this issue while using rbenv, please ensure that ruby is installed locally in project folder.
Occur due to some mismatch of packages, search for a package which shows the error and remove the package
After that
delete ios folder
install react native eject package
re-create ios folder
install pod
For me, I used
ts-node
to run some typescript code in the Run Script phase, the ts-node executable was not in/usr/local/bin/ts-node
which caused the build to fail.Try to run the code inside the Run Script editor directly in the terminal, that might give you a clue about why the build fails.