Ashok Ashok - 1 year ago 936
iOS Question

react-native: command not found

I am getting -bash: react-native: command not found error while creating react-native project.

Below are the additional info

1. brew --version
homebrew 0.9.9
2 brew info watchman
watchman stable 4.50
3. brew info flow
stable 0.24.1
4. brew info node
stable 6.1.0
5. npm -version
6. echo $PATH

I tried suggested steps from the below link but still i am getting same error.

  1. react-native-command-not-found

I don't have any directory "npm" directory which they have specified in the solution

Ashoks-MacBook-Pro:share Ashok$ ls
aclocal doc info ruby-build zsh
autoconf emacs man systemtap

But i found npm file exist in below location.


I uninstalled react-native and installed again but still i am facing same issue.

Answer Source

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
└── react-native-cli@0.2.0 

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!!!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download