Skip to content

Error loading Metro config in Expo #5957

@artema

Description

@artema

What React Native libraries do you use?

Expo (mobile only)

Are you using sentry.io or on-premise?

sentry.io (SaS)

Are you using any other error monitoring solution alongside Sentry?

No

Other Error Monitoring Solution Name

No response

@sentry/react-native SDK Version

8.7.0

How does your development environment look like?

System:
  OS: macOS 26.2
  CPU: (10) arm64 Apple M1 Pro
  Memory: 218.30 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.22.0
    path: /usr/local/bin/node
  Yarn:
    version: 4.6.0
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.9.4
    path: /usr/local/bin/npm
  Watchman:
    version: 2025.05.26.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /Users/artemabashev/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 25.4
      - iOS 26.4
      - macOS 26.4
      - tvOS 26.4
      - visionOS 26.4
      - watchOS 26.4
  Android SDK:
    API Levels:
      - "19"
      - "23"
      - "24"
      - "26"
      - "29"
      - "30"
      - "31"
      - "32"
      - "33"
      - "34"
      - "35"
      - "36"
    Build Tools:
      - 30.0.2
      - 31.0.0
      - 33.0.0
      - 33.0.0
      - 33.0.0
      - 34.0.0
      - 35.0.0
      - 36.1.0
    System Images:
      - android-19 | ARM EABI v7a
      - android-21 | ARM EABI v7a
      - android-21 | Intel x86 Atom
      - android-21 | Google APIs ARM 64 v8a
      - android-23 | Android TV ARM EABI v7a
      - android-23 | Android TV Intel x86 Atom
      - android-23 | ARM 64 v8a
      - android-23 | Google APIs ARM EABI v7a
      - android-29 | Google APIs ARM 64 v8a
      - android-30 | Android TV Intel x86 Atom
      - android-31 | Android TV ARM 64 v8a
      - android-32 | Google APIs ARM 64 v8a
      - android-36 | Google APIs ARM 64 v8a
      - android-37.0 | Pre-Release 16 KB Page Size Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2025.3 AI-253.30387.90.2532.14935130
  Xcode:
    version: 26.4/17E192
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.15
    path: /usr/bin/javac
  Ruby:
    version: 3.3.4
    path: /Users/artemabashev/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 20.1.3
    wanted: ^20.1.3
  react:
    installed: 19.2.0
    wanted: 19.2.0
  react-native:
    installed: 0.83.4
    wanted: 0.83.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Sentry.init()

N/A

Steps to Reproduce

Use Metro config in Expo 55:

const { getDefaultConfig } = require('expo/metro-config');
const { withSentryConfig } = require('@sentry/react-native/metro');

const config = getDefaultConfig(__dirname);

module.exports = withSentryConfig(config);

then run expo start

Expected Result

App builds normally.

Running npm i --save-dev metro fixes the issue.

Actual Result

Error: Error loading Metro config at: /Users/artemabashev/Projects/app/frontend/mobile/metro.config.js
Cannot find module 'metro/src/DeltaBundler/Serializers/baseJSBundle'
Require stack:
- /Users/artemabashev/Projects/app/frontend/mobile/node_modules/@sentry/react-native/dist/js/tools/vendor/metro/utils.js
- /Users/artemabashev/Projects/app/frontend/mobile/node_modules/@sentry/react-native/dist/js/tools/sentryMetroSerializer.js
- /Users/artemabashev/Projects/app/frontend/mobile/node_modules/@sentry/react-native/dist/js/tools/metroconfig.js
- /Users/artemabashev/Projects/app/frontend/mobile/node_modules/@sentry/react-native/metro.js
- /Users/artemabashev/Projects/app/frontend/mobile/metro.config.js
- ```

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions