我在關注安裝React Native https://facebook.github.io/react-native/docs/getting-started.html#content的最新說明05/31/2017。 我正在嘗試安裝react-native。我成功安裝自制軟件,節點,看守員,但是當我嘗試安裝陣營本地CLI使用此命令:在Mac上安裝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帶有節點。有沒有可能我沒有npm,但可以有nodejs?
[爲什麼「有人可以幫我嗎?」不是一個實際的問題?](https://meta.stackoverflow.com/q/284236/62576) –
可能重複[錯誤時安裝react-native-cli命令未找到](https://stackoverflow.com/questions/29767729/error-when-installed-react-native-cli-command-not-found)和[安裝react-native時出現路徑錯誤(Command not found error)](https://stackoverflow.com/q/32253981/ 62576)和[-bash:react-native:命令未找到錯誤](https://stackoverflow.com/q/33282545/62576) –
@KenWhite您能否向我解釋這些說明:您必須確保/ usr/local/share/npm/bin在您的PATH中使用npm安裝的二進制文件。 將以下內容添加到〜/ .bashrc中: export PATH =「/ usr/local/share/npm/bin:$ PATH」 然後重新加載shell會話。 這在https:// stackoverflow中找到。com/questions/33282545/bash-react-native-command-not-found文章 –