skip to Main Content

We have recently begun the process of updating out app from React Native 0.72.5 to 0.73.1, however currently whenever I try and buily the app locally on my M1 Macbook Pro using XCode, the build fails within seconds with the following hermes-engine error:

Command PhaseScriptExecution failed with a nonzero exit code

I have done a lot of Googling around this error and the consensus seems to be this will be related to the change in node version (we were previously running 16.20.0 but we have now updated the version to 18.18.2). We manage our node versions using nvm and I have set the default on my machine to the same version using the app by running nvm alias default 18.18.2, so XCode should be using the correct node version. I have cleared out the Derived Data folder, run a clean build etc. and no matter what, I still get the same error.

Any ideas on what I’m doing wrong here? Is this issue definitely still related to the node version and if so, how can I fix the issue? Thanks.

2

Answers


  1. There could be multiple reasons for iOS build failures.

    1. First of all, make sure that you are opening the .xcworkspace file in the iOS folder and not the .xcodeproj file.
    2. I am guessing you already tried this, but you need to delete the Pods and node_modules folders and the lock files related to these, and reinstall them.
    3. If it is a Node.js version issue, try removing the currently installed Node version and download a different version of Node (I am currently using v20.5.0). Alternatively, you could use NVM to manage different versions of Node (install guide for NVM here).
    4. My last guess is that this issue is caused by a new package that you installed. In that case, try to figure out which package is causing the issue. Check the version of the packages in the package.json file and update the outdated packages. Find a solution in the "Issues" tab of the GitHub repo of the package or find an alternative to that package.
    Login or Signup to reply.
  2. This also worked for me:

    This issue was fixed for me by deleting ios/.xcode.env.local. Then I ran pod install and installed the app successfully on my device.

    Courtesy of:

    https://github.com/facebook/react-native/issues/42221#issuecomment-1895955415

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search