React Native – FBReactNativeSpec Command PhaseScriptExecution failed with a nonzero exit code

For me anyone of this solutions work because, with Xcode 14.2 and RN0.70.5, there is the following 2 files in ios folder which fixe node version with the path (I don’t know since which version and which one adds this files) :

  1. .xcode.env
  2. .xcode.env.local

If you are this files inside ios folder just do this (with or without nvm) :

which node

And put the patch inside the .xcode.env.local like this :

export NODE_BINARY="/Users/Blabla/.nvm/versions/node/v16.14.0/bin/node"

If this files doesn’t exist, try to add it and maybe Xcode will take it into account :

Inside ios/.xcode.env

# This `.xcode.env` file is versioned and is used to source the environment
# used when running script phases inside Xcode.
# To customize your local environment, you can create an `.xcode.env.local`
# file that is not versioned.

# NODE_BINARY variable contains the PATH to the node executable.
#
# Customize the NODE_BINARY variable here.
# For example, to use nvm with brew, add the following line
# . "$(brew --prefix nvm)/nvm.sh" --no-use
export NODE_BINARY=$(command -v node)

Inside ios/.xcode.env.local

export NODE_BINARY="/Users/Blabla/.nvm/versions/node/v16.14.0/bin/node"

Leave a Comment