React native command not found

I am starting to establish a native response. I have successfully installed homebrew, nodejs, npm. but unable to establish a reaction to the native

I tried first

  npm install -g react-native-cli

gives me a warning about the entry:

  Missing write access to /Users/project/.npm-packages/lib/node_modules/react-native-cli

After that i tried

  sudo npm install -g react-native-cli
  /Users/project/.npm-packages/bin/react-native -> /Users/project/.npm-packages/lib/node_modules/react-native-cli/index.js
 /Users/project/.npm-packages/lib
 └── react-native-cli@1.0.0

Sounds like a setup.

After that i tried

  react-native init AwesomeProject
  Error: react-native: command not found

What could be the problem

+5
source share
2 answers

Make sure /usr/local/share/npm/bin is in your PATH to use binaries installed with npm

Add the following line to your ~ / .bashrc

export PATH="/usr/local/share/npm/bin:$PATH"

Then reload the shell session and try again

+5
source

First of all, you need to establish a response to global global communication.

 npm install -g react-native-cli 

then it will show you the way to respond to the native, as shown below.

 /Users/{yourUser}/.npm-packages/bin/react-native -> /Users/{yourUser}/.npm-packages/lib/node_modules/react-native-cli/index.js 

Then you need to set the default path from the above result and run the following command

 export PATH="/Users/{yourUser}/.npm-packages/bin/:$PATH" 

It will work like a charm!

+1
source

All Articles