PhaseScriptExecution failed for react-native-config on XCode build

zosozo picture zosozo · Dec 4, 2020 · Viewed 13.8k times · Source

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?

Answer

karlmarxlopez picture karlmarxlopez · Dec 13, 2020

Usually, this is caused by a badly formatted .env file. Double-check your .env.