native react 常用指令_react-native:找不到命令

I am getting -bash: react-native: command not found error while creating react-native project.

Below are the additional info

1. brew --version

homebrew 0.9.9

2 brew info watchman

watchman `enter code here`stable 4.50

/usr/local/Cellar/watchman/4.4.0

3. brew info flow

stable 0.24.1

/usr/local/Cellar/flow/0.24.1

4. brew info node

stable 6.1.0

/usr/local/Cellar/node/6.1.0

5. npm -version

3.8.6

6. echo $PATH

/Users/Ashok/.rbenv/shims:/Users/Ashok/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

I tried suggested steps from the below link but still i am getting same error.

I don't have any "npm" directory which they have specified in the solution

Ashoks-MacBook-Pro:share Ashok$ ls

aclocal doc info ruby-build zsh

autoconf emacs man systemtap

But i found npm file exist in below location.

/usr/local/Cellar/node/6.1.0/etc/bash_completion.d

I uninstalled react-native and installed again but still i am facing same issue.

解决方案

After adding right path to the PATH variable issue is resolved.

Below are the steps to find the right path.

1. Enter: npm install -g react-native-cli

output: /usr/local/Cellar/node/6.1.0/libexec/npm/bin/react-native ->/usr/local/Cellar/node/6.1.0/libexec/npm/lib/node_modules/react-native-cli/index.js/usr/local/Cellar/node/6.1.0/libexec/npm/lib

└── react-native-cli@0.2.0

from above output you can clearly see the path: /usr/local/Cellar/node/6.1.0/libexec/npm/bin/react-native

export PATH="/usr/local/Cellar/node/6.1.0/libexec/npm/bin:$PATH"

react-native init appName

cd appName

react-native run-ios

if you getting xcrun: error: unable to find utility "simctl" at this stage you can reslove using below steps

XCode -> Preferences -> Locations -> Command Line Tools -> Choose Xcode 7.2.1

You can find original solution from xcrun unable to find simctl

Thanks to @fbozo

That's It!!!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值