I'm getting the following build error when compiling my react-native project in Xcode env: node: No such file or directory
Not sure whats causing it? Node v8.9.4 React-Native v0.50.4 NPM v5.6.0 And I'm using nvm
I'm getting the following build error when compiling my react-native project in Xcode env: node: No such file or directory
Not sure whats causing it? Node v8.9.4 React-Native v0.50.4 NPM v5.6.0 And I'm using nvm
if you are using nvm do
sudo ln -s "$(which node)" /usr/local/bin/node
this will link current nvm to your usr local and next time Xcode will find the correct node path and version
Here is one of the solutions for this error if you're using nvm and sentry: https://docs.sentry.io/clients/react-native/manual-setup/#using-node-with-nvm
Xcode have some issues finding node from nvm, try this inside the script that throws the error:
# Setup nvm and set node
[ -z "$NVM_DIR" ] && export NVM_DIR="$HOME/.nvm"
if [[ -s "$HOME/.nvm/nvm.sh" ]]; then
. "$HOME/.nvm/nvm.sh"
elif [[ -x "$(command -v brew)" && -s "$(brew --prefix nvm)/nvm.sh" ]]; then
. "$(brew --prefix nvm)/nvm.sh"
fi
[ -z "$NODE_BINARY" ] && export NODE_BINARY="node"
$NODE_BINARY ../node_modules/@sentry/cli/bin/sentry-cli upload-dsym
In my case, this was related to an old sentry configuration and the fact that I use nvm.
Following https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/
you should be able to execute ln -s $(which node) /usr/local/bin/node and get it fixed
Add this at the top of the script that's failing (in Project -> build phases):
. ~/.nvm/nvm.sh