If for some strange reasons, the path to react-native
is not in the PATH
, you should take note where the react-native
executable is installed. Generally, the issue with command not found
is because they are not in PATH
.
For example, I use nodenv
and run npm install -g react-native
/Users/khoa/.nodenv/versions/10.10.0/bin/react-native -> /Users/khoa/.nodenv/versions/10.10.0/lib/node_modules/react-native/local-cli/wrong-react-native.js
So I need to add that to my PATH
export PATH=/Users/$HOMEPATH=$HOME/.nodenv/versions/10.10.0/bin:$PATH
You can verify with echo $PATH
Or you can use npx to execute local npm modules, for example
npx react-native run-ios --simulator='iPhone X'