3

Thanks for any help in advance , I am new to Mac in general so please forgive my question if its very straightforward, I installed native-react-cli and wanted to open/create a project . But I get the error 'react-native : command not found'

I install react-native-cli:

npm install -g react-native-cli
npm http GET https://registry.npmjs.org/react-native-cli
npm http 304 https://registry.npmjs.org/react-native-cli
npm WARN package.json react-native-cli@0.1.3 No README.md file found!
/usr/local/share/npm/bin/react-native -> /usr/local/share/npm/lib/node_modules/react-native-cli/index.js
react-native-cli@0.1.3 /usr/local/share/npm/lib/node_modules/react-native-cli

I try to open/create a project:

react-native AwesomeProject
-bash: react-native: command not found
react-native init helloWorld
-bash: react-native: command not found

Thanks for your time , I greatly appreciate any help

Davet
  • 334
  • 1
  • 3
  • 15
  • This doesn't seem to be a PATH issue as watchman (previously installed is found correctly) - when looking at version but react-native isn't found watchman -v 3.1.0 react-native -v -bash: react-native: command not found – Davet Apr 21 '15 at 09:39
  • 1
    OK I found the answer , for anyone else . I didn't have the correct PATH settings . In your terminal check that the path /usr/local/share/npm/bin is present in /etc/paths , using echo $PATH. If not use 'sudo nano /etc/paths' to open the paths file in nano. Add the required path to the bottom of the file, then type 'control-x' to quit and type 'Y' to save modified buffer. Then check paths again , this worked for me. – Davet Apr 21 '15 at 10:16
  • As a temporary fix, you can add ```PATH=${PATH}:/usr/local/bin``` at the beginning of react-native-xcode.sh . You can check your npm bin directory with ```npm config --global get prefix``` – Gabriel Lupu Nov 06 '15 at 17:20
  • check this http://stackoverflow.com/questions/37189081/react-native-command-not-found – Ashok R Dec 05 '16 at 06:09

2 Answers2

2

I had this issue, and it was simply due to my brew not being up to date.

I updated brew and re-installed the components listed at https://facebook.github.io/react-native/docs/getting-started.html#content and it was happy again.

1

you have to add right path to your path variable.

check this: react-native: command not found

Community
  • 1
  • 1
Ashok R
  • 19,892
  • 8
  • 68
  • 68