build.gradle - 为什么在 build.gradle 上启用 hermes 时这个 bundleReleaseJsAndAssets 会失败?

标签 build.gradle react-native

我刚刚克隆了这个存储库,但出现了这个错误。

当我尝试运行 ./gradlew installReleasenpx react-native run-android --variant=release 时,由于 Hermes 而出现此错误。是的,我在我的 build.gradle 上启用了 Hermes。它在没有爱马仕的情况下工作。

> Task :app:bundleReleaseJsAndAssets
warning: the transform cache was reset.
Loading dependency graph, done.
...
info Done writing sourcemap output
info Done writing bundle output
info Copying 13 asset files
info Done copying assets

> Task :app:bundleReleaseJsAndAssets FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> A problem occurred starting process 'command '../../node_modules/hermes-engine/osx-bin/hermes''

我正在使用 macOS。

我运行了 yarn add hermes-engine 来确保这个节点模块存在。我发现了很多 github 问题,但它们大多是关于 Windows 的。

最佳答案

只需检查您是否使用的是 Windows 以及您的 PC 是否仅旧一年,那么您必须卸载 visual c++ 2019 redistributable,安装 visual c++ 2015 redistributable。

如果你有 linux,那么就没有额外的需要。

我认为这个问题的发生是因为您可能已经完成了 2-3 次构建。 所以我的建议是只执行 cd android & gradlew clean & gradlew assembleRelease。

关于build.gradle - 为什么在 build.gradle 上启用 hermes 时这个 bundleReleaseJsAndAssets 会失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63430791/

相关文章:

ios - 在 `React-Core` 中未找到 `../node_modules/react-native/React` 的 podspec

react-native - 如何将 native rn-range-slider 重置为其初始状态

reactjs - 如何在react-native 0.56 (Babel 7) 中通过装饰器使用mobx

java - Ant 到 Gradle 转换 : Obfuscation and Jar

android - 如何在android中存储API凭据并避免反编译攻击?

android - Gradle报告文件大小

android - 将 React Native 组件嵌入到平台原生代码中?

ios - Xcode/Simulator 与物理设备上的 React Native 字体大小不同

android - 程序类型已经存在 : kotlinx. coroutines.experimental.EventLoopBase

android - Flutter gradle.build 错误 : Could not get unknown property 'compileSdkVersion' for extension 'flutter' of type FlutterExtension