找不到React本机命令 [英] React native command not found

查看:198
本文介绍了找不到React本机命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始安装反应原生。我已经成功安装了homebrew,nodejs,npm。但是无法安装反应原生

I am starting to install react native. I had successfully installed homebrew, nodejs , npm. but not able to install react native

首先我试过了


npm install -g react-native-cli

给我写警告:


Missing write access to /Users/project/.npm-packages/lib/node_modules/react-native-cli

之后我尝试了


sudo npm install -g react-native-cli




/Users/project/.npm-packages/bin/react-native -> /Users/project/.npm-packages/lib/node_modules/react-native-cli/index.js
/Users/project/.npm-packages/lib
└── react-native-cli@1.0.0

看起来像是安装。

之后我尝试了


react-native init AwesomeProject




Error : react-native: command not found

可能是什么问题

推荐答案

确保 / usr / loca l / share / npm / bin 在您的PATH中使用与npm一起安装的二进制文件

Make sure that /usr/local/share/npm/bin is in your PATH to use binaries installed with npm

将以下行添加到〜/ .bashrc

Add the following line to your ~/.bashrc

export PATH =/ usr / local / share / npm / bin:$ PATH

然后重新加载你的shell会话并再试一次

Then reload your shell session and try that again

这篇关于找不到React本机命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆