Skip to content

[iOS][SwiftPM] 0.87 Release app crashes because Hermes compiler emits bytecode 98 but runtime expects 99 #57917

Description

@marandaneto

Description

React Native 0.87's experimental full SwiftPM iOS integration selects incompatible Hermes compiler and runtime versions for Release builds.

npx react-native spm add --deintegrate --yes does two independent Hermes resolutions:

  1. download-spm-artifacts.js defaults the SwiftPM runtime artifact to hermes-compiler/latest-v1. At reproduction time this resolves to 260318099.0.1, so the generated artifacts.json points at:

    hermes-ios/260318099.0.1/hermes-ios-260318099.0.1-hermes-ios-release.tar.gz

  2. generate-spm-xcodeproj.js resolves hermes-compiler/package.json from the React Native npm dependency tree and injects that compiler as HERMES_CLI_PATH. React Native 0.87.0 pins hermes-compiler@250829098.0.16.

The selected compiler emits HBC bytecode version 98, while the downloaded SwiftPM runtime expects bytecode version 99. The Release build succeeds, but the app terminates immediately when launched:

Compiling JS failed: Wrong bytecode version. Expected 99 but got 98

This is reproducible in a stock bare React Native CLI app with no third-party native dependencies. CocoaPods is not used after spm add --deintegrate.

Expected behavior: the SwiftPM Hermes runtime artifact and HERMES_CLI_PATH compiler must be selected from the same Hermes version.

Relevant 0.87.0 code:

A temporary workaround is to install hermes-compiler@260318099.0.1 at the app level and point HERMES_CLI_PATH at that matching compiler.

Steps to reproduce

  1. Clone https://github.com/marandaneto/react-native-087-swiftpm-hermes-bytecode-repro

  2. Run npm run reproduce. This installs dependencies, converts the stock project using npx react-native spm add --deintegrate --yes, prints the selected compiler and runtime versions, and performs a Release simulator build.

  3. Boot an iOS Simulator.

  4. Install the generated app:

    xcrun simctl install booted ios/build/DerivedData/Build/Products/Release-iphonesimulator/HermesSwiftPMRepro.app

  5. Launch it with console output:

    xcrun simctl launch --terminate-running-process --console-pty booted org.reactjs.native.example.HermesSwiftPMRepro

The process terminates with Wrong bytecode version. Expected 99 but got 98.

React Native Version

0.87.0

Affected Platforms

Runtime - iOS, Build - MacOS

Output of npx @react-native-community/cli info

System:
  OS: macOS 26.6
  CPU: (14) arm64 Apple M4 Pro
  Memory: 4.18 GB / 48.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 26.7.0
    path: /opt/homebrew/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 11.19.0
    path: /opt/homebrew/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/lib/ruby/gems/4.0.0/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 25.5
      - iOS 26.5
      - macOS 26.5
      - tvOS 26.5
      - visionOS 26.5
      - watchOS 26.5
IDEs:
  Xcode:
    version: 26.6/17F113
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 21.0.11
  Ruby:
    version: 4.0.6
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 20.2.0
    wanted: 20.2.0
  react:
    installed: 19.2.3
    wanted: 19.2.3
  react-native:
    installed: 0.87.0
    wanted: 0.87.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

Stacktrace or Logs

Compiler selected by generated HERMES_CLI_PATH:
node_modules/hermes-compiler/hermesc/osx-bin/hermesc
Hermes release version: 250829098.0.16
HBC bytecode version: 98

SwiftPM release artifacts.json:
https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/260318099.0.1/hermes-ios-260318099.0.1-hermes-ios-release.tar.gz

Runtime:
ReactInstance: evaluateJavaScript() with JS bundle
Js error message: getPropertyAsObject: property 'console' is undefined, expected an Object
Original js error message: Non-js exception: Compiling JS failed: Wrong bytecode version. Expected 99 but got 98, sourceURL: .../HermesSwiftPMRepro.app/main.jsbundle
*** Terminating app due to uncaught exception 'RCTFatalException: NSException: Unhandled JS Exception: [runtime not ready]: Error: Non-js exception: Compiling JS failed: Wrong bytecode version. Expected 99 but got 98'
libc++abi: terminating due to uncaught exception of type NSException

MANDATORY Reproducer

https://github.com/marandaneto/react-native-087-swiftpm-hermes-bytecode-repro

Screenshots and Videos

Not applicable; the Release app terminates immediately and the console output above contains the failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions