React native iOS build failed Xcode

52 Views Asked by At

I have developed a React Native project and attempted to execute the iOS build through Xcode. However, each attempt results in a failure with the error message "Command PhaseScriptExecution failed with a nonzero exit code." What steps should I take to troubleshoot and resolve this issue? Project Configuration react-native:0.73.5 react: 18.2.0 node: 18.17.0

Xcode version: 15.3(15E204a) System Configuration: MacOS: Sonoma 14.2.1 Chip: M1 Memory: 8GB

[enter image description here](https://i.stack.imgur.com/VY5L4.jpg)

To address this, I have already taken the following actions:

  1. Deleted the pods and reinstalled them.
  2. Cleaned the build and attempted to run the project again.
  3. deleted derivedData files and tried to run again
2

There are 2 best solutions below

0
DinhNguyen On

Delete this file fixed the issue: ios\.xcode.env.local

cd ios
rm -rf .xcode.env.local
4
Sally Azulay On

Have you added any shell script to your scheme or in build phases? It not, Have to tried to add OpenSSL to your project ?

In order to do so, go to your target and select build phases. then select Link Binary With Libraries, click on the plus sign and search for OpenSSL

enter image description here

Next do the following steps:

  1. on the top nav click on Product and select Clean Build Folder.
  2. Delete the derived data folder.
  3. Delete Pods folder and Podfile.lock file.
  4. Open xCode again and try to run it again.
  5. Deleting xcode.env.local might hekp as well.

That helped me when initialize new react native project. Hope that will help you as well.