Skip to content

Windows - Next.js standalone output (pnpm) may contain symlinks resolving outside .next/standalone #95450

Description

@timheerwagen

Link to the code that reproduces this issue

https://github.com/timheerwagen/next-standalone-pnpm-symlink-repro

To Reproduce

pnpm install
pnpm build
pnpm test - The script shows the resolved path of the standalone Next Node module.

Current vs. Expected behavior

When using Next.js with output: "standalone" together with pnpm, the generated standalone output contains symlinks inside .next/standalone/node_modules that resolve to the root node_modules/.pnpm dir instead of the .next/standalone/node_modules/.pnpm directory.

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Home
  Available memory (MB): 16294
  Available CPU cores: 12
Binaries:
  Node: 24.11.1
  npm: 11.16.0
  Yarn: N/A
  pnpm: 10.23.0
Relevant Packages:
  next: 16.2.10 // Latest available version is detected (16.2.10).
  eslint-config-next: N/A
  react: 19.2.7
  react-dom: 19.2.7
  typescript: N/A
Next.js Config:
  output: standalone

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

Module Resolution

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

next build (local)

Additional context

This behaviour only occurs on Windows and not on Linux, as demonstrated here: https://github.com/timheerwagen/next-standalone-pnpm-symlink-repro/actions/runs/28657904104/job/84991341147.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Module ResolutionModule resolution (CJS / ESM, module resolving).

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions