Skip to content

Metro cannot resolve expo-router/entry with pnpm isolated node_modules on Expo SDK 57 #619

Description

@Farley-Chen

Environment:

  • uniwind: 1.10.0
  • expo: 57.0.8
  • expo-router: 57.0.8
  • react-native: 0.86.0
  • metro: 0.84.4
  • pnpm
  • Android Development Build

Metro config:

const { getDefaultConfig } = require('expo/metro-config');
const { withUniwindConfig } = require('uniwind/metro');

const config = getDefaultConfig(__dirname);

module.exports = withUniwindConfig(config, {
  cssEntryFile: './src/global.css',
  dtsFile: './src/uniwind-types.d.ts',
});

Error:

Unable to resolve module ./node_modules/expo-router/entry from the project root.

The file exists at node_modules/expo-router/entry.js.

The stack trace passes through:

uniwind/dist/metro/index.cjs

  • nativeResolver
  • resolveRequest

Workaround:

Adding the following .npmrc and reinstalling dependencies fixes the issue:

node-linker=hoisted

pnpm's default isolated node_modules layout consistently reproduces the issue.

maybe related: expo/router #748

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem right

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions