Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xcode can't find node binary for react-native project

I deleted nvm from my mac (I deleted the ~/.nvm-folder), and I installed node through the installer from their website.

I have a React Native project I want to build in XCode, but I get the following error:

Node found at: /Users/username/.nvm/versions/node/v18.19.1/bin/node
/Users/username/Library/Developer/Xcode/DerivedData/app-gnvlyyajukhnelhalqtfeuwftjrn/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/hermes-engine.build/Script-46EB2E0002AB40.sh: line 9: /Users/username/.nvm/versions/node/v18.19.1/bin/node: No such file or directory

I think somewhere in XCode/my project, the old path of node (nvm) is still persisted. What I did so far:

  1. added export NODE_BINARY=/usr/local/bin/node to .zshrc -> didn't work
  2. deleted node_modules, deleted pods, ... -> didn't work
  3. deleted the derivedData folder of XCode -> didn't work
  4. set a symlink to /usr/local/bin/node -> this symlink already exists, didn't work

Where to set this node path?

like image 809
Sam Leurs Avatar asked Jul 23 '26 12:07

Sam Leurs


1 Answers

There is a environment for local saved at react-native-project/ios/.xcode.env.local:

export NODE_BINARY=/Users/mac/.nvm/versions/node/[old version]/bin/node

Edit the version number:

export NODE_BINARY=/Users/mac/.nvm/versions/node/v20.15.1/bin/node

If you want to know the current version number, then check current node path by type command -v node on terminal:

reference: React Native - FBReactNativeSpec Command PhaseScriptExecution failed with a nonzero exit code

like image 154
jacobkim Avatar answered Jul 26 '26 06:07

jacobkim



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!