Hermes error: Error encoding bytecode
yogeshpaliyal opened this issue · 8 comments
What happened?
On hermes command getting the error, without any specific error message.
error: Error encoding bytecode <Printing the whole js bundle>
I am trying to create bundle for React-Native, earlier we were using the metro bundler, but now we want to add tree-shaking capability to it, so we are trying rnx-kit.
Our react native version: 0.72.7
Trying to create bundle independently without gradle.
Affected Package
@rnx-kit/metro-serializer-esbuild
Version
0.1.33
Which platforms are you seeing this issue on?
- Android
- iOS
- macOS
- Windows
System Information
System:
OS: macOS 14.4.1
CPU: (10) arm64 Apple M1 Pro
Memory: 340.58 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 16.15.1
path: ~/.nvm/versions/node/v16.15.1/bin/node
Yarn:
version: 1.22.19
path: ~/.nvm/versions/node/v16.15.1/bin/yarn
npm:
version: 8.12.1
path: ~/.nvm/versions/node/v16.15.1/bin/npm
Watchman: Not Found
Managers:
CocoaPods:
version: 1.15.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.4
- iOS 17.4
- macOS 14.4
- tvOS 17.4
- visionOS 1.1
- watchOS 10.4
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Xcode:
version: 15.3/15E204a
path: /usr/bin/xcodebuild
Languages:
Java:
version: 11.0.11
path: /Users/<username>/.jenv/shims/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.7
wanted: 0.72.7
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: false
newArchEnabled: false
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Steps to Reproduce
babel.config.js
presets: [["module:metro-react-native-babel-preset", { disableImportExportTransform: true }]]
metro.config.js
const { makeMetroConfig } = require('@rnx-kit/metro-config');
const { MetroSerializer, esbuildTransformerConfig } = require('@rnx-kit/metro-serializer-esbuild');
module.exports = makeMetroConfig({
serializer: {
customSerializer: MetroSerializer([], {
logLevel: 'verbose',
target: 'hermes0.11.0'
})
},
transformer: esbuildTransformerConfig,
});
Note: Tried default target as well.
Using command to create js bundle.
react-native bundle --platform android --dev false --entry-file index.js --bundle-output bundle.js --sourcemap-output bundle.map --reset-cache
Command to run hermes:
node_modules/react-native/sdks/hermesc/osx-bin/hermesc -O -w -g -emit-binary -output-source-map -out bundle.hbc bundle.js
Code of Conduct
- I agree to follow this project's Code of Conduct
@tido64
Can this be because of different version of hermes in react-native and esbuild.
- Which tool is outputting the error?
- What else is output besides
Error encoding bytecode
? - Does the bundle work without the
hermesc
step?
- I am using a normal terminal.
- It is printing the whole js bundle after the error.
- I haven't tried running this and will try this and update on this.
- I am using a normal terminal.
Sorry, what I meant to say is which "command". Is hermesc
outputting this? Can you get more logging enabled? This is not much to go on.
- I am using a normal terminal.
Sorry, what I meant to say is which "command". Is
hermesc
outputting this? Can you get more logging enabled? This is not much to go on.
Yes hermesc
is giving the error.
Not able to start logging in hermesc is there any flag to enable logging. I was not able to find a flag to enable logging.
- No the bundle is not working without hermes as well, getting this logs repetitive and then app crashes.
@set_metadata: update dataspace from GM (0x00000000 -> 0x0801000)
Can you create a minimal repro? This is unfortunately not enough information for us to start an investigation.