0

I'm following the latest instructions 05/31/2017 on installing React Native on https://facebook.github.io/react-native/docs/getting-started.html#content. I'm attempting to install react-native. I successfully installed Homebrew, Node, Watchman but when I tried installing React Native CLI with this command:

npm install -g react-native-cli

it gave me this error message:

-bash: npm: command not found.

I then used this command: curl -0 -L https://npmjs.org/install.sh | sudo sh

and the terminal gave me this message: enter image description here

I then tried running this code:

react-native init AwesomeProject

but got this error message:

-bash: react-native: command not found

can someone help me overcome this obstacle so I can successfully installing React Native CLI? Thank you.

I already checked out the following but to no avail:

Error when installed react-native-cli command not found

Path error while installing react-native (Command not found error)

-bash: react-native: command not found

** NOTE ** node -v gives me v6.10.1 but when i do this: npm -v it says -bash: npm: command not found

I thought npm came with node. Is it possible that I do not have npm but have can have nodejs?

Saia Fonua
  • 45
  • 8
  • [Why is "Can someone help me?" not an actual question?](https://meta.stackoverflow.com/q/284236/62576) – Ken White Jun 01 '17 at 02:51
  • Possible duplicate of [Error when installed react-native-cli command not found](https://stackoverflow.com/questions/29767729/error-when-installed-react-native-cli-command-not-found) and [Path error when installing react-native (Command not found error)](https://stackoverflow.com/q/32253981/62576) and [-bash: react-native: command not found error](https://stackoverflow.com/q/33282545/62576) – Ken White Jun 01 '17 at 02:52
  • @KenWhite can you explain these instructions to me: You have to make sure /usr/local/share/npm/bin is in your PATH to use binaries installed with npm. Add the following to your ~/.bashrc: export PATH="/usr/local/share/npm/bin:$PATH" And reload your shell session. this is found in the https://stackoverflow.com/questions/33282545/bash-react-native-command-not-found article – Saia Fonua Jun 01 '17 at 03:17

1 Answers1

0

Run npm install -g react-native-cli again. You didn't have npm installed before, when you ran the curl statement, that installed npm, but you now need to install the react-native-cli.

Greg Billetdeaux
  • 2,039
  • 13
  • 9
  • Trying closing your console and reopening it, then run `npm -v` to see if you've got npm. If it doesn't return an error, run your `sudo nm install -g react-native-cli`. If that doesn't error, then run your `react-native init AwesomeProject` – Greg Billetdeaux Jun 01 '17 at 03:22
  • that's weird. I have node v6.10.1. But when I check for npm -v it says `-bash: npm: command not found`. I thought npm came with NodeJs. @Greg Billetdeaux – Saia Fonua Jun 01 '17 at 03:29
  • Looks like it didn't properly get hooked up to your PATH variable? Make sure you properly installed node, and maybe try doing it again. – Greg Billetdeaux Jun 01 '17 at 03:32