【问题标题】:React native gradle build fail : "node -e console.log(require('react-native/cli').bin);" : command fail反应原生 gradle 构建失败:“node -e console.log(require('react-native/cli').bin);” : 命令失败
【发布时间】:2020-04-19 15:08:16
【问题描述】:

我尝试在全新的 Ubuntu 18.04 安装上的 android 模拟器中运行我的 React Native 应用程序。

在 Android Studio 中,gradle build 失败并出现此错误:

[org.gradle.api.Script] :ReactNative:Running '[node, -e, console.log(require('react-native/cli').bin);'] command failed.

[org.gradle.internal.buildevents.BuildExceptionReporter] * Where:
[ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Script '/home/melvine/DevProjects/production/evener/mobile/node_modules/@react-native-community/cli-platform-android/native_modules.gradle' line: 179

但是,当我在项目文件夹中运行以下命令时,它运行成功。

$ node -e "console.log(require('react-native/cli').bin);"

/home/melvine/DevProjects/production/evener/mobile/node_modules/react-native/node_modules/@react-native-community/cli/build/bin.js

怎么了?

【问题讨论】:

  • 你使用的是哪个 react-native 版本
  • @EL173 我正在使用"react-native": "0.62.2"

标签: android react-native gradle


【解决方案1】:

我找到了解决方案。我已经使用 nvm 安装了 NodeJS,但是(我不知道为什么)Gradle 无法执行它。所以我用 apt-get 安装了节点,现在一切正常。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-25
    • 1970-01-01
    相关资源
    最近更新 更多