创建React Native项目后,遇到Command `run-android` unrecognized. Make sure that you have run `npm install` and that you are inside a react-native project.的错误。

一、问题

在执行react-native init FirstApp(自己的项目名称) 创建项目后,再执行react-native run-android的时候,会报Command 'run-android' unrecognized. Make sure that you have run 'npm install' and that you are inside a react-native project.的错误。

二、解决办法

首先cd进入自己的项目下,如cd C:\Users\Feng\FirstApp; 然后再执行命令npm install,这期间会需要几分钟,等它安装完毕。

三、运行项目

安装完毕后,再执行react-native run-android命令,首先要保证你的已运行了一个可用的模拟器。然后就可以看到项目运行起来了。

你可能感兴趣的:(创建React Native项目后,遇到Command `run-android` unrecognized. Make sure that you have run `npm install` and that you are inside a react-native project.的错误。)