#93556·Next.js

Turbopack fails to resolve next/package.json with pnpm v11 enableGlobalVirtualStore

Author: yamaaaaaa31Created May 7, 2026Updated Sep 16, 2026
LabelsTurbopack

Link to the code that reproduces this issue

https://github.com/yamaaaaaa31/turbopack-pnpm-v11-repro

To Reproduce

  1. Clone the reproduction repository.
  2. Use pnpm v11.
  3. Make sure pnpm global virtual store is enabled:
# pnpm-workspace.yaml
enableGlobalVirtualStore: true
  1. Install dependencies:
pnpm install
  1. Start the development server with Turbopack:
pnpm dev
  1. Open the app route in the browser.

Current vs. Expected behavior

When enableGlobalVirtualStore: true is enabled in pnpm v11, node_modules/next is a symlink whose real path points outside the project root, for example:

node_modules/next -> ~/Library/pnpm/store/v11/links/.../node_modules/next

With Turbopack, next dev fails when serving the app because it cannot resolve next/package.json:

Couldn't find the Next.js package (next/package.json)
from project directory: <project>/src/app

Expected behavior: Turbopack should handle pnpm v11 global virtual store symlinks for normal runtime dependencies, including Next.js itself, or provide a clear error/workaround.

This does not happen when using webpack dev mode.

Additional verification:

  • This also reproduces with next@canary.
  • This is not specific to output: "standalone". The linked reproduction does not set output: "standalone" and still reproduces.
  • Setting experimental.externalDir: true does not address this. The failure appears to happen at Turbopack's filesystem root / symlink resolution layer, before regular external source imports.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.4.0
  Available memory (MB): 49152
  Available CPU cores: 14
Binaries:
  Node: 22.22.2
  npm: 10.9.7
  Yarn: N/A
  pnpm: 11.0.6
Relevant Packages:
  next: 16.2.4
  eslint-config-next: N/A
  react: 19.2.5
  react-dom: 19.2.5
  typescript: N/A
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Turbopack

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

This seems related to pnpm v11's enableGlobalVirtualStore: true.

In this setup, realpath(node_modules/next/package.json) points outside the project root. Setting turbopack.root to the app root is not enough. A workaround is to set turbopack.root to the common ancestor of the app root and the real path of node_modules/next/package.json, but that can become a very broad directory such as the user's home directory.

Workarounds observed:

  • pnpm dev --webpack works.
  • Disabling enableGlobalVirtualStore avoids the issue.
  • Setting turbopack.root to the common ancestor of the app root and realpath(node_modules/next/package.json) works, but in real projects this can require broadening the root to a directory like the user's home directory, which is not a practical default.

Related issues / PRs: