【问题标题】:-bash: react-native: command not found on MAC-bash: react-native: 在 MAC 上找不到命令
【发布时间】:2019-09-04 20:15:29
【问题描述】:
$ 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 update 之后,我陷入了困境,无法继续进行。

【问题讨论】:

    标签: react-native


    【解决方案1】:

    在官方文档中有一个入门指南,其中有一个关于React Native CLI 的部分。安装命令是:

    npm install -g react-native-cli
    

    如果命令失败,它还包括附加信息:

    如果您遇到无法找到模块“npmlog”之类的错误,请尝试直接安装 npm:curl -0 -L https://npmjs.org/install.sh | sudo sh

    【讨论】:

      【解决方案2】:

      我跟着

      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

      【讨论】:

        猜你喜欢
        • 2019-09-23
        • 1970-01-01
        • 2017-11-02
        • 2017-02-02
        • 2019-06-14
        • 2012-10-03
        • 1970-01-01
        • 2016-09-08
        相关资源
        最近更新 更多