react-native -bash:react-native:找不到命令

时间:2019-05-30 06:22:48

标签: react-native

我安装节点和守望者

 brew install node
 brew install watchman

然后安装React Native CLI

npm install -g react-native-cli

但是当我使用react-native初始化测试

我有错误: -bash:react-native:找不到命令

2 个答案:

答案 0 :(得分:0)

第一
       sudo npm install -g react-native-cli

此命令输出路径如下

/usr/local/bin/react-native -> /usr/local/lib/node_modules/react-native-cli/index.js

然后(用于上面的路径示例)

export PATH="/usr/local/lib/node_modules/react-native-cli/index.js"

react-native init appName

答案 1 :(得分:0)

尝试:sudo npm install -g react-native-cli

npx ,然后以npx react-native init demo