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
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
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
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
The solution I used documented here, was to create a script at /usr/local/bin/node
that calls nvm
#!/usr/bin/env sh
# Use the version of node specified in .nvmrc to run the supplied command
export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && \. "/usr/local/opt/nvm/nvm.sh" # This loads nvm
nvm_rc_version > /dev/null 2> /dev/null
HAS_NVM_RC=$?
if [[ "$HAS_NVM_RC" == "0" ]] ; then
nvm run $*
else
nvm run default $*
fi
exit $?