7

I am trying to run basic react-native app in my macOS. I installed node through brew .

My node version: v6.12.0
npm version :5.5.1

Then i installed reatc-native-cli using npm. Now when i try to create a project using react-native init it says react-native command not found.

I tried all solutions but no hope. as i am new bee to this react-native guide me solve this. Thanks in advance.

I tried all post including

react-native: command not found

Vikas Yadav
  • 3,094
  • 2
  • 20
  • 21
Subburaj
  • 5,114
  • 10
  • 44
  • 87

5 Answers5

5

You should install React-Native CLI first before using "react-native init".

npm install -g react-native-cli

For more information of getting started React-Native in manual, please follow this Document

https://facebook.github.io/react-native/docs/getting-started.html

And select tab Building Projects with Native Code for manual create project without Expo

Seyha
  • 323
  • 4
  • 12
3

Steps to install React Native CLI in Mac OS:

  1. Run npm install -g react-native-cli

or sudo npm install -g react-native-cli 2. Once successful, get the installed path from the output:

/Users/jeemok/.npm-packages/bin/react-native -> /Users/jeemok/.npm-packages/lib/node_modules/react-native-cli/index.js
+ react-native-cli@2.0.1
added 78 packages from 28 contributors in 12.39s

In my case, my path is /Users/jeemok/.npm-packages/bin/react-native 3. Run export PATH="/Users/jeemok/.npm-packages/bin:$PATH" 4. Now you should be able to use the command react-native


Example to init a project

react-native init TodoApp
cd TodoApp
react-native run-ios
Jee Mok
  • 6,157
  • 8
  • 47
  • 80
0

1.install -Xcode -Android Studio
2. react-native init FirstApp

  1. if hit the below error -bash:react-native:command not found

4. npm list -g | head -n 1
5. /usr/local/Cellar/node/8.1.4/lib U will found the file "react native"
6. open .bash_profile (if .bash_profile not exist setup .bash_profile) add the below in .bash_profile file export PATH=”/usr/local/Cellar/node/8.1.4/bin:$PATH”

  1. run the command to reload .bash_profile source .bash_profile

8.create your project
react-native init FirstApp

anson
  • 1,436
  • 14
  • 16
0

How I solved this issue.

  1. Call npm list -g | head -n 1
  2. Open .bash_profile in a code editor. It should be located at ~/.bash_profile
  3. Paste export PATH="/usr/local/Cellar/node/10.12.0/bin:${PATH}" somewhere in it. Make sure you have the correct version in there. Also make sure PATH is wrapped in { }
  4. Save the file.
  5. Close your terminal and reopen. You should be good now.
0

How I solved this not found issue. For those who are still facing the issue, I am sharing my solution. I have setup a fresh react native project by running the following command.

npx react-native init AwesomeProject

we don't need to install

react-native-cli

If you previously installed a global react-native-cli package, please remove it as it may cause unexpected issues.

as mentioned in the original docs.

just add npx at beginning npx react native link and it worked!

MDK
  • 131
  • 2
  • 4