react-native run-android无法识别 [英] react-native run-android is unrecognized

查看:172
本文介绍了react-native run-android无法识别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经全局安装了react-native-cli:

I've installed react-native-cli globally:

npm install -g react-native-cli

然后运行:

react-native init AwesomeProject
cd AwesomeProject

我有以下结构:

-- AwesomeProject   
---- node_modules      
------ react-native    

运行 react-native run-android 时出现错误:
无法识别命令 run-android .您是要在本机项目中运行此程序吗?

When I run react-native run-android I get an error:
Command run-android unrecognized. Did you mean to run this inside a react-native project?

当我运行react-native启动时,我会得到相同的结果.

When I run react-native start I get the same.

react-native -v
印刷品:
react-native-cli:0.2.0
react-native:不适用-不在React Native项目目录中

我做错了什么?

推荐答案

是什么原因导致我在运行 npm install --save [package] 时,实际上系统以前一直在使用纱线,而不是 npm .

What caused this for me was running npm install --save [package] when actually the system has previously been using yarn instead of npm.

要解决此问题,我只删除了 node_modules 文件夹并运行: yarn install ,然后执行了 react-native run-ios (或android)正常.

To solve this I just deleted the node_modules folder and ran: yarn install and after that react-native run-ios (or android) works fine.

(复制为 React Native:命令`run-ios`无法识别)

这篇关于react-native run-android无法识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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