Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 340 Vote(s) - 3.53 Average
  • 1
  • 2
  • 3
  • 4
  • 5
React Native ios build : Can't find node

#1
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?
Reply

#2
Open Xcode, then choose "Preferences..." from the Xcode menu.

Go to the Locations panel and install the tools by selecting the most recent version in the Command Line Tools dropdown.

select command line tools like as this image
[![enter image description here][1]][1]


[1]:
Reply

#3
The solution for me is to set a default version of `node` with `nvm` in your profile. This works for bash or zsh:

Add this to your `.zshrc` or `.bashrc`

# default node version for nvm
nvm use 8.9.3

Be sure to change it to the version you want when starting a new terminal.
Reply

#4
I found one
[solution](

[To see links please register here]

)

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][1]][1]





[1]:

Reply

#5
@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
Reply

#6

```
nvm alias default 14
```
***OR***

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

This made my Xcode 12.4 see node
Reply

#7
If you are using Mac, check if you have installed node with brew. In this case it cannot find the path. Install node by downloading from the official website
Reply

#8
Solution for nvm users :

In your build phases scripts, just add

# Fix for machines using 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

Above `export NODE_BINARY=node`. This will make Xcode work regardless of your machine using nvm.
Reply

#9
The best solution is to actually do `ln -s $(which node) /usr/local/bin`, this will create a "symlink" from `/usr/local/bin/node` to wherever your node is, this is important because most apps looks at node at this path. You probably don't want to do `export NODE_BINARY=[your node path]` because when another teammate has a different OS or different installation of node (i.e., one is using nvm the other is using homebrew), then the same error will occur, it will also happen when building for production. So just go with `ln -s $(which node) /usr/local/bin` to be safe.
Reply

#10
For anyone that stumbles upon this in 2022 here is my situation and how I fixed it.

1. `react-native --version` -> 4.14
2. `npx --version` -> 6.14.9
3. `node --version` -> 12.14.1
4. We use TypeScript also.

XCode "Bundle React Native code and images"


[![enter image description here][1]][1]

export ENTRY_FILE=src/App.tsx
../node_modules/react-native/scripts/react-native-xcode.sh
../node_modules/expo-constants/scripts/get-app-config-ios.sh
../node_modules/expo-updates/scripts/create-manifest-ios.sh

Remove the `export NODE_BINARY=node` line of code. It's not needed anymore. The way I figured this out was reading through the source code found in `../node_modules/react-native/scripts/react-native-xcode.sh` If you look there, you'll find nvm/node sourcing being done for you.


[1]:
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through