首页 > 解决方案 > react-native run-android 安装时出错,无法在 Windows 10 中运行

问题描述

我目前正在运行 Windows 10。我遵循了https://facebook.github.io/react-native/docs/getting-started上有关 android 开发的文档中的所有步骤,但出现以下错误:

在此处输入图像描述

我尝试卸载和清理我的安装目录两次,但仍然有相同的错误。

我真的很想为 React Native 设置我的开发环境,但我不知道下一步该做什么。

我正在使用的版本(最新): react-native-cli: 2.0.1 react-native: 0.56.0

任何帮助将不胜感激。谢谢!

编辑 - 这是输出react-native start

在此处输入图像描述

标签: androidreactjsreact-native

解决方案


我认为这是 0.56 版中的一个错误。“解决方案”是找到依赖项版本的正确组合。正确地一一尝试此命令...

react-native init AwesomeProject
cd AwesomeProject
react-native run-android
npm uninstall react-native
npm install --save react-native@0.55.4
react-native run-android
npm install --save babel-core@latest babel-loader@latest
npm uninstall --save babel-preset-react-native
npm install --save babel-preset-react-native@4.0.0
react-native run-android

推荐阅读