vercel / vercel/next.js

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

Open
#95,450 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Module Resolution
Dominant language
JavaScript
Stars
142k
Forks
32.5k
Avg merge
2d 13h
Merged PRs (30d)
334

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked next-standalone-pnpm-symlink-repro repository and run pnpm install, pnpm build, and pnpm test on Windows. Trace the standalone output produced by next build and compare the resolved paths under .next/standalone/node_modules with the Linux behavior described in the issue. Done means the generated symlinks resolve within .next/standalone/node_modules/.pnpm on Windows.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nextjs, node.js
Domain
backend, build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.