最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - react-native not found + mac os - Stack Overflow

programmeradmin6浏览0评论

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
Add a ment  | 

5 Answers 5

Reset to default 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

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
+ [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. Run export PATH="/Users/jeemok/.npm-packages/bin:$PATH" 4. Now you should be able to use the mand react-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

  1. 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”

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

8.create your project
react-native init FirstApp

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.

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!

发布评论

评论列表(0)

  1. 暂无评论