Skip to content

Unable to resolve module @react-native-harness/bridge/client #46

@manud99

Description

@manud99

Describe the bug

I tried to run React-Native-Harness for my Expo app on a real Android phone. I managed to start the Metro server but the app crashed because one endpoint returned the following error.

Endpoint: http://localhost:8081/.expo/.virtual-metro-entry.bundle?platform=android&dev=true&lazy=true&minify=false&app=com.example&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server

Unable to resolve module @react-native-harness/bridge/client from /Users/manuel/code/redmesh-app/node_modules/@react-native-harness/runtime/dist/client/factory.js: @react-native-harness/bridge/client could not be found within the project or in these directories:
  node_modules/@react-native-harness/runtime/node_modules
  node_modules

  1  | import { getBridgeClient } from '@react-native-harness/bridge/client';
  | ^
  2 | import { store } from '../ui/state.js';
  3 | import { getTestRunner } from '../runner/index.js';
  4 | import { getTestCollector } from '../collector/index.js';

I solved the issue locally by creating the file node_modules/@react-native-harness/bridge/client.js with the following contents:

export * from './dist/client.js';
export { default } from './dist/client.js';

I suspect the problem is that getBridgeClient is not exported from @react-native-harness/bridge/client's index.ts but is imported in @react-native-harness/runtime/src/client/factory.ts. Maybe adding this second line to @react-native-harness/bridge/src/index.ts helps:

export * from './shared.js';
export * from './client.js';

System Info

System:
  OS: macOS 15.6.1
  CPU: (10) arm64 Apple M4
  Memory: 147.55 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.19.0
    path: /Users/manuel/.nvm/versions/node/v22.19.0/bin/node
  Yarn: Not Found
  npm:
    version: 10.9.3
    path: /Users/manuel/.nvm/versions/node/v22.19.0/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/lib/ruby/gems/3.4.0/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.5
      - iOS 18.5
      - macOS 15.5
      - tvOS 18.5
      - visionOS 2.5
      - watchOS 11.5
  Android SDK: Not Found
IDEs:
  Android Studio: 2025.1 AI-251.27812.49.2514.14217341
  Xcode:
    version: 16.4/16F6
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.16
    path: /usr/bin/javac
  Ruby:
    version: 3.4.5
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 20.0.2
    wanted: latest
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.9
    wanted: 0.76.9
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

React Native Harness Version

1.0.0-alpha.19

Reproduction

Steps to reproduce

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