nextjs - ✅(Solved) Fix Issue: pnpm unpack-next fails on Windows due to POSIX-quoted tar paths [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#87833Fetched 2026-04-08 02:06:01
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
cross-referenced ×1issue_type_added ×1labeled ×1referenced ×1

Running pnpm unpack-next fails on Windows because Next.js dev tooling builds tar commands using POSIX single-quoted paths ('path'). Windows’ built-in tar.exe treats single quotes as literal characters, causing tarballs to not be found and the command to fail.

Error Message

The command fails on Windows with an error similar to: tar: Error opening archive: Failed to open 'D:\...\tarballs\next.tar'

Root Cause

Running pnpm unpack-next fails on Windows because Next.js dev tooling builds tar commands using POSIX single-quoted paths ('path'). Windows’ built-in tar.exe treats single quotes as literal characters, causing tarballs to not be found and the command to fail.

Fix Action

Fixed

PR fix notes

PR #87834: fix: make unpack tar paths cross platform compatible

Description (problem / solution / changelog)

What?

Fix Windows failures in Next.js local pack/unpack tooling by updating tar commands to use double-quoted paths instead of POSIX single-quoted paths.

Why?

Windows’ built-in tar.exe does not support POSIX single-quoted paths and treats them as literal characters. This causes pnpm unpack-next (and related pack scripts) to fail because tarballs cannot be found or extracted on Windows.

How?

Replaced single-quoted tar path arguments with double-quoted paths in pack and unpack scripts. Double-quoted paths are supported on Linux, macOS, and Windows, making the tooling cross-platform safe.

Fixes #87833

Changed files

  • scripts/unpack-next.ts (modified, +1/-1)

Code Example

2.

---

3.

---

4.

---

5.

---

### Current vs. Expected behavior

### Current Behavior
The command fails on Windows with an error similar to:

---

Windows tar.exe treats the single-quoted path as a literal filename, so the tarball cannot be found and unpacking fails.

<img width="1878" height="831" alt="Image" src="https://github.com/user-attachments/assets/4b313758-e10f-418f-bc59-1cefc9bf2be2" />


### Expected Behavior
Tarballs should unpack successfully and inject the locally built Next.js packages into the target app without errors.

### Provide environment information
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/naveenkarmegam/next.js/blob/canary/scripts/unpack-next.ts#L29

To Reproduce

To reproduce this issue must use windows os

Summary

Running pnpm unpack-next fails on Windows because Next.js dev tooling builds tar commands using POSIX single-quoted paths ('path'). Windows’ built-in tar.exe treats single quotes as literal characters, causing tarballs to not be found and the command to fail.

Steps

  1. git clone https://github.com/vercel/next.js
  2. cd next.js
  3. pnpm install
  4. pnpm pack-next --no-js-build --tar
  5. pnpm unpack-next apps/bundle-analyzer

Current vs. Expected behavior

Current Behavior

The command fails on Windows with an error similar to: tar: Error opening archive: Failed to open 'D:\...\tarballs\next.tar'

Windows tar.exe treats the single-quoted path as a literal filename, so the tarball cannot be found and unpacking fails.

<img width="1878" height="831" alt="Image" src="https://github.com/user-attachments/assets/4b313758-e10f-418f-bc59-1cefc9bf2be2" />

Expected Behavior

Tarballs should unpack successfully and inject the locally built Next.js packages into the target app without errors.

Provide environment information

Operating System:
  Platform: windows
  Arch: x64
  Version: Windows 11 Pro
Binaries:
  Node: 20.18.2
  pnpm: 9.6.0

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

Testing

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

next package testing

Additional context

No response

extent analysis

TL;DR

The issue can be fixed by modifying the unpack-next.ts script to use double quotes instead of single quotes for paths on Windows.

Guidance

  • The error occurs because Windows' built-in tar.exe treats single-quoted paths as literal characters, causing the tarball to not be found.
  • To verify the issue, run the pnpm unpack-next command on a Windows machine and check for the error message indicating that the tarball cannot be found.
  • A potential workaround is to modify the unpack-next.ts script to use double quotes for paths on Windows, similar to how POSIX systems handle double quotes.
  • The unpack-next.ts script should be updated to handle the difference in path quoting between Windows and POSIX systems.

Example

// In unpack-next.ts, update the tar command to use double quotes on Windows
const tarCommand = process.platform === 'win32' ? `tar -xvf "${tarballPath}"` : `tar -xvf '${tarballPath}'`;

Notes

This fix assumes that the issue is solely due to the difference in path quoting between Windows and POSIX systems. If other issues are present, additional modifications may be necessary.

Recommendation

Apply workaround: The best course of action is to update the unpack-next.ts script to handle the difference in path quoting between Windows and POSIX systems, as this will allow the pnpm unpack-next command to work correctly on both platforms.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - ✅(Solved) Fix Issue: pnpm unpack-next fails on Windows due to POSIX-quoted tar paths [1 pull requests, 1 participants]