If your React Native builds fail in Xcode with the following message:
Command PhaseScriptExecution failed with a nonzero exit code
one possible reason could be that Xcode is using an outdated version of Node (in my case, it was because I use nvm to manage my Node versions, but Xcode used an old version of Node that I had installed via HomeBrew a long time ago).
By default, Xcode will use the Node binary located at
/usr/local/bin/node. Check its version by running:
/usr/local/bin/node -v node -v
If the first command outputs an older version of Node, simply delete it and replace it with a symlink to the newer one:
rm -rf /usr/local/bin/node ln -s $(which node) /usr/local/bin/node
Hope that helps!