Edit this page
A guide on configuring Hermes for both Android and iOS in an Expo project.
Hermes is a JavaScript engine optimized for React Native. By compiling JavaScript into bytecode ahead of time, Hermes can improve your app start-up time. The binary size of Hermes is also smaller than other JavaScript engines, such as JavaScriptCore (JSC). It also uses less memory at runtime, which is particularly valuable on lower-end Android devices.
The Hermes engine is the default JavaScript engine used by Expo and it is fully supported across all Expo tooling.
You may want to use Hermes on one platform and JSC on another. One way to do this is to set the "jsEngine"
to "hermes"
at the top level in app config and then override it with "jsc"
under the "ios"
key. You may alternatively prefer to explicitly set "hermes"
on just the "android"
key in this case.
{
"expo": {
"jsEngine": "hermes",
"ios": {
"jsEngine": "jsc"
}
}
}
Publishing updates with eas update
and npx expo export
will generate Hermes bytecode bundles and their source maps.
Note that the Hermes bytecode format may change between different Hermes versions — an update produced for a specific version of Hermes will not run on a different version of Hermes. Starting from Expo SDK 46 (React Native 0.69), Hermes is bundled within React Native. Updating React Native version or Hermes version can be thought of in the same way as updating any other native module. So if you update the react-native
version you should also update the runtimeVersion
in app.json. If you don't do this, your app may crash on launch because the update may be loaded by an existing binary that uses an older Hermes version that is incompatible with the updated bytecode format. See runtimeVersion
for more information.
To debug JavaScript code running with Hermes, you can start your project with npx expo start
then press j to open the debugger in Google Chrome or Microsoft Edge. The developer menu of development builds and Expo Go also have the Open JS Debugger option to do the same.
Alternatively, you can use the JavaScript inspector from the following tools:
No compatible apps connected. JavaScript Debugging can only be used with the Hermes engine.
when opening the debugger.
Make sure you set up Hermes in the jsEngine
field.
If your app is built by eas build
, npx expo run:android
or npx expo run:ios
, make sure it is a debug build.
Internally, the app will establish a WebSocket connection, make sure your app is connected to the development server.
curl http://127.0.0.1:8081/json/list
(adjust the 127.0.0.1:8081
to match your dev server URL). The HTTP response should be an array, as shown below. If it is an empty response, add either the --localhost
or --tunnel
flag to the npx expo start
command.[
{
"id": "0-2",
"description": "host.exp.Exponent",
"title": "Hermes ABI47_0_0React Native",
"faviconUrl": "https://react.dev/favicon.ico",
"devtoolsFrontendUrl": "devtools://devtools/bundled/js_app.html?experiments=true&v8only=true&ws=%5B%3A%3A1%5D%3A8081%2Finspector%2Fdebug%3Fdevice%3D0%26page%3D2",
"type": "node",
"webSocketDebuggerUrl": "ws://[::1]:8081/inspector/debug?device=0&page=2",
"vm": "Hermes"
},
{
"id": "0--1",
"description": "host.exp.Exponent",
"title": "React Native Experimental (Improved Chrome Reloads)",
"faviconUrl": "https://react.dev/favicon.ico",
"devtoolsFrontendUrl": "devtools://devtools/bundled/js_app.html?experiments=true&v8only=true&ws=%5B%3A%3A1%5D%3A8081%2Finspector%2Fdebug%3Fdevice%3D0%26page%3D-1",
"type": "node",
"webSocketDebuggerUrl": "ws://[::1]:8081/inspector/debug?device=0&page=-1",
"vm": "don't use"
}
]
One of the many limitations of remote debugging is that it does not work with modules built on top of JSI, such as react-native-reanimated
version 2 or higher.
Hermes supports Chrome DevTools Protocol to debug JavaScript in place by connecting to the engine running on the device, as opposed to remote debugging, which executes JavaScript within a desktop Chrome tab. Hermes apps use this debugging technique automatically when you open the debugger in Expo Go or a development build.