$ react-native -v
-bash:react-native:未找到命令
$ brew --version
Homebrew 2.1.0
Homebrew/homebrew-core (git revision c2b3; last commit 2019-04-14)
Homebrew/homebrew-cask (git revision 8953; last commit 2019-04-14)
$ which node
/usr/local/bin/node
$ ls -l $(which node)
lrwxr-xr-x 1 kishore admin 31 Apr 14 11:17 /usr/local/bin/node -> ../Cellar/node/11.14.0/bin/node
$ echo $PATH
/usr/local/share/npm/bin:/usr/local/opt/sqlite/bin:/usr/local/opt/openssl/bin:/usr/local/opt/sqlite/bin:/usr/local/opt/openssl/bin:/usr/local/opt/icu4c/sbin:/usr/local/opt/icu4c/bin:/usr/local/opt/icu4c/sbin:/usr/local/opt/icu4c/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
我已经尝试了以下建议,但没有运气: react-native: command not found
Error when installed react-native-cli command not found
react-native not found + mac os
-bash: react-native: command not found
请帮助,我是React-Native的新手。我能够构建项目,并且在brew更新之后,我受够了,无法继续进行下去。
答案 0 :(得分:0)
在官方文档中,有React Native CLI上的一节的入门指南。安装它的命令是:
npm install -g react-native-cli
如果命令失败,它还包括其他信息:
如果遇到诸如找不到模块'npmlog'之类的错误,请尝试直接安装npm:
curl -0 -L https://npmjs.org/install.sh | sudo sh
。
答案 1 :(得分:0)
我关注了
http://rkulla.blogspot.com/2014/03/the-path-to-homebrew.html
为节点设置正确的$ PATH,然后
npm install -g react-native-cli
路径并重新安装RN cli有助于在Mac上设置正确的路径并解决。
还值得花时间观看视频,这有助于我了解有关NPM安装以及如何在Mac上设置Access的信息
https://www.youtube.com/watch?v=bxvybxYFq2o&list=PLgSF2JABRs0H-bH6GJ1IJ26jaRrPGDuvf