【发布时间】:2017-11-02 00:26:32
【问题描述】:
我正在遵循 2017 年 5 月 31 日关于在 https://facebook.github.io/react-native/docs/getting-started.html#content 上安装 React Native 的最新说明。 我正在尝试安装 react-native。我成功安装了 Homebrew、Node、Watchman,但是当我尝试使用以下命令安装 React Native CLI 时:
npm install -g react-native-cli
它给了我这个错误信息:
-bash: npm: command not found。
然后我使用了这个命令:
curl -0 -L https://npmjs.org/install.sh | sudo sh
终端机给了我这样的信息: enter image description here
然后我尝试运行这段代码:
react-native init AwesomeProject
但收到此错误消息:
-bash: react-native: command not found
有人可以帮助我克服这个障碍,以便我可以成功安装 React Native CLI 吗?谢谢。
我已经检查了以下但无济于事:
Error when installed react-native-cli command not found
Path error while installing react-native (Command not found error)
-bash: react-native: command not found
** 注意 **
node -v 给我 v6.10.1
但是当我这样做时:
npm -v 上面写着-bash: npm: command not found
我以为 npm 是带有 node.js 的。有没有可能我没有npm但有可以有nodejs?
【问题讨论】:
-
@KenWhite 您能否向我解释这些说明:您必须确保 /usr/local/share/npm/bin 在您的 PATH 中才能使用与 npm 一起安装的二进制文件。将以下内容添加到您的 ~/.bashrc: export PATH="/usr/local/share/npm/bin:$PATH" 并重新加载您的 shell 会话。这可以在stackoverflow.com/questions/33282545/… 文章中找到
标签: react-native