我刚刚克隆了这个存储库,但出现了这个错误。
当我尝试运行 ./gradlew installRelease
或 npx 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/