react-native: command not found
Solution 1:
After adding right path to the PATH variable issue is resolved.
Below are the steps to find the right path.
1. Enter: npm install -g react-native-cli
output: /usr/local/Cellar/node/6.1.0/libexec/npm/bin/react-native ->/usr/local/Cellar/node/6.1.0/libexec/npm/lib/node_modules/react-native-cli/index.js/usr/local/Cellar/node/6.1.0/libexec/npm/lib
└── [email protected]
from above output you can clearly see the path: /usr/local/Cellar/node/6.1.0/libexec/npm/bin/react-native
export PATH="/usr/local/Cellar/node/6.1.0/libexec/npm/bin:$PATH"
react-native init appName
cd appName
react-native run-ios
if you getting xcrun: error: unable to find utility "simctl" at this stage you can reslove using below steps
XCode -> Preferences -> Locations -> Command Line Tools -> Choose Xcode 7.2.1
You can find original solution from xcrun unable to find simctl
Thanks to @fbozo
That's It!!!
Solution 2:
After continually running into this problem, and hitting this answer and not having it work..
Assuming you don't run npm as root/sudo (which you shouldn't do!) your npm modules will be installed in whatever you set your default directory to be.
Assuming you have followed those instructions, and your default directory is ~/.npm-global, then you need to add ~/.npm-global/bin to your path.
This is outlined in those instructions, but for me I added this to .bashrc:
export PATH=$PATH:$HOME/.npm-global/bin
Then restart your shell and it will work.