Enabling Hermes breaks android/iOS builds
See original GitHub issueEnvironment
"react": "^17.0.2"
"react-native": "^0.64.2"
"webpack": "^5.44.0"
"@callstack/repack": "^2.0.0-beta.7"
Description
On android, if we enable hermes as seen below, assembling the app fails to execute on task app:bundleReleaseJsAndAssets
. However, if we switch back to using the metro bundler, Hermes works fine. We want to keep using repack for the webpack benefits, but also need Hermes for the project.
project.ext.react = [
entryFile: "index.js",
enableHermes: true,
bundleCommand: "webpack-bundle", // removing this line fixes the error
]
Reproducible Demo
- Create new react native app
- Follow callstack/repack documentation for installation and setup
- Copy-paste the webpack config template
- Enable Hermes for android build and assemble release build
Errors
iOS
▸ Linking beacon.dev
❌ ld: building for iOS Simulator, but linking in dylib built for iOS, file '/Users/stephenlu/Documents/heroai/frontend/app/ios/Pods/hermes-engine/destroot/Library/Frameworks/iphoneos/hermes.framework/hermes' for architecture arm64
❌ clang: error: linker command failed with exit code 1 (use -v to see invocation)
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening beaconapp.xcworkspace.
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution Bundle\ React\ Native\ code\ and\ images /Users/stephenlu/Library/Developer/Xcode/DerivedData/beaconapp-akmcdfwbbupxepbpqfxdjntkinhn/Build/Intermediates.noindex/beaconapp.build/DebugDev-iphoneos/beaconapp.build/Script-00DD1BFF1BD5951E006B06BC.sh
(1 failure)
info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Android
> Task :app:bundleDevReleaseJsAndAssets FAILED
FAILURE: Build failed with an exception.
* Where:
Script '/Users/stephenlu/Documents/heroai/frontend/app/node_modules/react-native/react.gradle' line: 173
* What went wrong:
Execution failed for task ':app:bundleDevReleaseJsAndAssets'.
> Process 'command '../../node_modules/hermes-engine/osx-bin/hermesc'' finished with non-zero exit value 2
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 32s
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Using Hermes - React Native
Hermes is an open-source JavaScript engine optimized for React Native. For many apps, using Hermes will result in improved start-up time, ...
Read more >React Native Firebase
React Native Firebase · 1. Install via NPM · 2. Android Setup · 3. iOS Setup · 4. Autolinking & rebuilding · Android...
Read more >React Native (Android) - Failed to transform hermes-debug.aar
1. After using command npx react-native upgrade , there are changes in number version of dependencies. I also edit build.gradle in ...
Read more >React Native: What You Need To Know About Hermes.
TL;DR: Hermes is an open-source lightweight JavaScript engine optimized for React Native built by Facebook, It improves performance by ...
Read more >Troubleshooting my builds - Help Center - Jscrambler Docs
Application breaks on Hermes Engine. Problem. Hermes is an open-source JavaScript engine optimized for React Native. Some of those optimizations cause a mal- ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Alright, so I was able to successfully run both commands. For future reference, these are the packages that I had to add to the babel loader rules:
Thanks so much @zamotany for your help!
@TheMatrixMaster how did you find out all the dependencies which needed babel transpiling ? if you can explain the process, that would be grt i am stuck in a similar situation