React Native ios build : Can’t find node
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)
因为我是使用了nvm作为node的版本管理工具,所以xCode在使用node时,找不到。
which node
/Users/sharkship/.nvm/versions/node/v12.16.1/bin/node
我们可以使用软连接的方式,将node链接到 /usr/local/bin/node
目录上,xCode即可找到node
ln -s $(which node) /usr/local/bin/node
当然在使用nvm
更换完node版本时,需要使用上述命令进行node的更新。