Skip to content

pnpm unpack-next does not work on Windows #82233

Description

@R4R3D1FF

Link to the code that reproduces this issue

https://github.com/MariusNWK/parallel

To Reproduce

  1. In a local clone of the next.js repo on Windows, run pnpm pack-next --tar.
  2. Run pnpm unpack-next path/to/project for any local project.

Current vs. Expected behavior

Expected:
All required packages would be created in the node_modules of the destination folder

Current:

Image
PS C:\Users\mausa\Documents\sources\next.js> pnpm unpack-next "C:\Users\mausa\Documents\sources\parallel"

                                                                                                        > nextjs-project@0.0.0 unpack-next C:\Users\mausa\Documents\sources\next.js
> tsx scripts/unpack-next.ts "C:\\Users\\mausa\\Documents\\sources\\parallel"


Unpack next
> tar -xf 'C:\Users\mausa\Documents\sources\next.js/tarballs/next.tar' -C 'C:\Users\mausa\Documents\sources\parallel\node_modules\next'

tar: Error opening archive: Failed to open ''C:\Users\mausa\Documents\sources\next.js/tarballs/next.tar''
node:internal/errors:983
  const err = new Error(message);
              ^

Error: Command failed: tar -xf 'C:\Users\mausa\Documents\sources\next.js/tarballs/next.tar' -C 'C:\Users\mausa\Documents\sources\parallel\node_modules\next'
    at genericNodeError (node:internal/errors:983:15)
    at wrappedFn (node:internal/errors:537:14)
    at checkExecSyncError (node:child_process:882:11)
    at execSync (node:child_process:954:15)
    at exec (C:\Users\mausa\Documents\sources\next.js\scripts\pack-util.ts:32:12)
    at path (C:\Users\mausa\Documents\sources\next.js\scripts\unpack-next.ts:29:3)
    at Object.<anonymous> (C:\Users\mausa\Documents\sources\next.js\scripts\unpack-next.ts:30:1)
    at Module._compile (node:internal/modules/cjs/loader:1565:14)
dules\tsx\dist\register-DCnOAxY2.cjs:2:1186)
    at Module.load (node:internal/modules/cjs/loader:1318:32) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 18920,
  stdout: null,
  stderr: null
}

Node.js v22.12.0

Provide environment information

Operating System:
  Platform: Windows
  Arch: AMD64
  Version: 10.0.26100
Binaries:
  Node: v22.12.0
  npm: 10.9.0
  Yarn: 1.22.22
  pnpm: 9.6.0
Relevant packages:
  next: v15.4.2-canary.18

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

Script (next/script)

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

next build (local), next start (local)

Additional context

The filesystem library seems to use command prompt rather than powershell, and thus quoting paths doesnt work. Also, on Windows this results in a combination of '' and '/'.
Moreover, the swc path on projects in Windows is something like swc-win32-x64-msvc, not swc, and thus can't be found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions