Skip to content

Cannot find module issues persist #4286

Open

Description

@IrvingArmenta

Requirements: This library requires Mapbox Maps SDK v11 and React Native 0.79+ with New Architecture (Fabric/TurboModules).

For sponsors-only support and resources: https://github.com/rnmapbox/maps/wiki/SponsorsRepo
Become a sponsor for special support: https://github.com/sponsors/rnmapbox


Environment

  • Dev OS: Windows 11 (PowerShell)
  • @rnmapbox/maps version: 10.3.5
  • React Native version: Expo SDK 57 (React Native 0.73+)
  • Expo CLI version: 57.0.18
  • pnpm version: 11.23.0

Steps to reproduce

pnpx create-expo-app sample
cd sample

# Install rnmapbox/maps
pnpm expo install @rnmapbox/maps@latest

# Add plugin
# app.json:
# {
#   "expo": {
#     "plugins": ["@rnmapbox/maps"]
#   }
# }

pnpm expo prebuild --clean
pnpm expo run:android

Actual behavior

1. Expo cannot resolve the config plugin in app.json

In VS Code, hovering over "@rnmapbox/maps" inside "plugins" shows:
Cannot find module '@rnmapbox/maps'

2. Expo prebuild fails with module resolution errors

During the Expo config plugin phase, the build fails with:
Cannot find module '@rnmapbox/maps'

Expected Behavior

Expo’s config plugin should be discoverable in app.json, and Expo should load:
lib/module/Mapbox.js

Activity

  1. Hot-IOce commented on Aug 26, 2026

    @Hot-IOce

    This looks like pnpm's module layout rather than anything in @rnmapbox/maps — the giveaway is that it fails identically in the VS Code plugin resolution and in expo prebuild, on a package that is definitely installed.

    By default pnpm uses the isolated node-linker: real packages live in node_modules/.pnpm and only your direct dependencies get symlinked at the top level. Expo's config-plugin resolution require.resolves the plugin from the project root and follows the realpath into the store, where the package's own dependency graph isn't resolvable — so it reports the plugin as missing even though it's installed.

    Expo's recommended setup for pnpm is the hoisted linker. Create .npmrc next to package.json:

    node-linker=hoisted
    then reinstall from clean, because the existing tree is already in the wrong shape:

    rm -rf node_modules pnpm-lock.yaml
    pnpm install
    pnpm expo prebuild --clean
    (PowerShell: Remove-Item -Recurse -Force node_modules, pnpm-lock.yaml)

    One extra thing specific to Windows 11: pnpm's default layout needs symlinks, and Windows only allows creating them with Developer Mode on or from an elevated shell. If that's off, pnpm silently produces a tree that looks right and doesn't resolve. Worth enabling Developer Mode before the reinstall — Settings → System → For developers.

    Same failure shows up with other config plugins under pnpm — there are matching open reports against react-native-maps and react-native-datetimepicker — so it isn't Mapbox-specific, which hopefully saves you chasing it in the wrong repo.

    If it still fails after the hoisted reinstall, post the output of pnpm why @rnmapbox/maps and whether node_modules/@rnmapbox/maps is a real directory or a symlink — that'll separate a resolution problem from an install problem.

  2. IrvingArmenta commented on Sep 1, 2026

    @IrvingArmenta
    Author

    @Hot-IOce

    Thanks for the explanation. I’ve moved from pnpm to bun, and I’m installing everything with bun install --linker hoisted as recommended in the bun docs. After switching, Expo no longer reports a resolution issue, but now app.json shows a different message saying the Mapbox plugin itself isn’t set up correctly.

    I can import the package normally (import Mapbox from '@rnmapbox/maps') and VS Code resolves the .d.ts file without problems. The folder node_modules/@rnmapbox/maps exists as a real directory, not a symlink. However, when running the app in an EAS development build, the module is undefined at runtime.

    I’m on Expo SDK 57 (React Native 0.73+), Expo CLI 57.0.18, and bun 1.3.14;
    bun expo prebuild --clean, expo-doctor, and expo install --check all pass without errors.

    Also, the pnpm workaround you mentioned is outdated. Recent pnpm versions changed their linker behavior, so the old fix doesn’t apply anymore.

    Just adding this context in case it helps narrow down what’s actually happening.

    Attaching screenshot of the text that app.json shows now

    Image
  3. mfazekas commented on Oct 13, 2026

    @mfazekas
    Contributor

    Thanks for the details. The app.json hover message comes from the VS Code Expo Tools extension, which uses an outdated config-plugin resolver; it doesn't affect builds. On a fresh SDK 57 app, expo prebuild works for us with npm, pnpm 11 (default linker) and bun.

    If pnpm expo prebuild still fails, please paste the full output and check the install log for ERR_PNPM_IGNORED_BUILDS, which can leave packages uninstalled. For the "module undefined" case, please share the exact runtime error/stack, how you import the package, your actual React Native version, and a minimal repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions