0

I am brand new to React native, and following the instructions on the 'getting started' page I came across the following problem. I ran the npm install, however I get react-native: command not found. I did brew install node, and brew install watchman and both installed without errors. Additionally I downloaded xcode from the mac app store earlier today. Any help is appreciated!

Also - I tried the solution on this SO post, however, it still isn't working.

Below is output from the terminal, as well as my .bashrc file located in ~/.

Desktop npm install -g react-native-cli
/Users/roni/.npm-global/bin/react-native -> /Users/roni/.npm-global/lib/node_modules/react-native-cli/index.js
/Users/roni/.npm-global/lib
└── react-native-cli@1.2.0 

 Desktop react-native init reactNativeTest
-bash: react-native: command not found

.bashrc

source /usr/local/opt/nvm/nvm.sh
export PATH="/usr/local/share/npm/bin:$PATH"

### Added by the Bluemix CLI
source /usr/local/Bluemix/bx/bash_autocomplete

Please note I changed npm's default directory to another directory, per the npm docs on fixing npm permissions

Make a directory for global installations:

 mkdir ~/.npm-global
Configure npm to use the new directory path:

 npm config set prefix '~/.npm-global'
Open or create a ~/.profile file and add this line:

 export PATH=~/.npm-global/bin:$PATH
Back on the command line, update your system variables:

 source ~/.profile
Community
  • 1
  • 1
Ron I
  • 4,090
  • 8
  • 33
  • 64
  • 1
    did you add `~/.npm-global/bin` to your PATH? What is the output for `echo $PATH`? – dting Nov 12 '16 at 05:53
  • @DTing yes that was it! I added ~/.npm-global/bin to my .bash_profile and it works. If you reply with an answer I will mark it correct. Cheers. – Ron I Nov 13 '16 at 18:21

1 Answers1

2

Copied down from the comment:

Add ~/.npm-global/bin to your PATH, as per the direction:

 npm config set prefix '~/.npm-global'
Open or create a ~/.profile file and add this line:

 export PATH=~/.npm-global/bin:$PATH
dting
  • 38,604
  • 10
  • 95
  • 114