Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native ios build : Can't find node

I have a prototype ready to go and the project is jammed with build:

error: Can't find 'node' binary to build React Native bundle If you have non-standard nodejs installation, select your project in Xcode, find 'Build Phases' - 'Bundle React Native code and images' and change NODE_BINARY to absolute path to your node executable (you can find it by invoking 'which node' in the terminal)

this feedback is helpless for me, i do have node with nvm. is this something related to bash?

like image 312
Seeliang Avatar asked Jun 12 '17 05:06

Seeliang


Video Answer


2 Answers

@brunocascio solution on the comment is simpler and less invasive, create a symlink to node, on command line:

ln -s $(which node) /usr/local/bin/node 

Update:

On new M1 Mac I had to cd /usr/local then mkdir bin (or just sudo mkdir /usr/local/bin) first.

thanks leo for the comment

like image 69
josesuero Avatar answered Sep 21 '22 07:09

josesuero


I found one solution

First find your current node, in shell

which node 

then copy your node url to

export NODE_BINARY=[your node path] ../node_modules/react-native/packager/react-native-xcode.sh to node_modules/react-native/scripts/react-native-xcode.sh 

enter image description here

like image 28
Seeliang Avatar answered Sep 20 '22 07:09

Seeliang