nlogn nlogn - 27 days ago 23
Node.js Question

React-native installation issue

Followed the setup steps from official site,I am not able to find react-natve command refer below console commands and its output:

Bhushans-MBP:node_modules bhushanraut$ npm install -g react-native-cli
/Users/bhushanraut/.npm-packages/bin/react-native -> /Users/bhushanraut/.npm-packages/lib/node_modules/react-native-cli/index.js
/Users/bhushanraut/.npm-packages/lib
└── react-native-cli@1.2.0

Bhushans-MBP:node_modules bhushanraut$ react-native init AwesomeProject
-bash: react-native: command not found


Please help me to resolve this.Thanks in advance.

Answer

The issue is /Users/bhushanraut/.npm-packages/bin/ directory is not added to global PATH variable.

You need add that to PATH variable.

Execute the below command in terminal

vi ~/.bash_profile 

This will open the file in vi editor. Append the following line in that file.

export PATH=$PATH:'/Users/bhushanraut/.npm-packages/bin/'

Then save and close the file.

Execute the following command

source ~/.bash_profile 

Now try executing react-native init AwesomeProject command. This should solve the problem.

Comments