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 mand 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: mand not found
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 mand 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: mand not found
Share Improve this question edited Jan 29, 2018 at 8:41 Vikas Yadav 3,3542 gold badges22 silver badges22 bronze badges asked Nov 29, 2017 at 10:12 SubburajSubburaj 5,19211 gold badges47 silver badges95 bronze badges 3-
1
What was the mand used to install it? Did you use
npm install -g
and did it succeed without errors? – Vasan Commented Nov 29, 2017 at 10:16 -
Isn't React Native project create
create-react-native-app <name>
? – Zooly Commented Nov 29, 2017 at 10:17 - Using appropriate version of npm will resolve the issue. – Vikas Yadav Commented Jan 29, 2018 at 8:12
5 Answers
Reset to default 5You 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
Steps to install React Native CLI in Mac OS:
- 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
+ [email protected]
added 78 packages from 28 contributors in 12.39s
In my case, my path is
/Users/jeemok/.npm-packages/bin/react-native
3. Runexport PATH="/Users/jeemok/.npm-packages/bin:$PATH"
4. Now you should be able to use the mandreact-native
Example to init a project
react-native init TodoApp
cd TodoApp
react-native run-ios
1.install
-Xcode
-Android Studio
2.
react-native init FirstApp
- if hit the below error -bash:react-native:mand 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”
- run the mand to reload .bash_profile source .bash_profile
8.create your project
react-native init FirstApp
How I solved this issue.
- Call
npm list -g | head -n 1
- Open .bash_profile in a code editor. It should be located at
~/.bash_profile
- 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 { } - Save the file.
- Close your terminal and reopen. You should be good now.
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 mand.
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!