Skip to content

fix: invoke pnpm via npm_execpath on Windows (fixes #19) - #107

Open
Sainigurnoor511 wants to merge 1 commit into
cloudflare:mainfrom
Sainigurnoor511:fix/windows-pnpm-spawn-19
Open

fix: invoke pnpm via npm_execpath on Windows (fixes #19)#107
Sainigurnoor511 wants to merge 1 commit into
cloudflare:mainfrom
Sainigurnoor511:fix/windows-pnpm-spawn-19

Conversation

@Sainigurnoor511

Copy link
Copy Markdown

Summary

  • Add \scripts/pnpm-command.mjs\ to resolve pnpm invocations on Windows without a shell: when
    pm_execpath\ points at pnpm's .cjs/.mjs\ entry (as under \pnpm run), run
    ode ...\ so argv boundaries survive intact.
  • Reject
    pm-cli.js\ via the path guard so
    pm run\ does not silently use the wrong package manager.
  • Update all nested pnpm call sites on the local dev path, plus \scripts/generate-worker-types.mjs\ (flagged in pnpm run-local cannot start on Windows: spawnSync pnpm ENOENT #19).
  • Surface spawn failures in \generate-worker-types.mjs\ when
    esult.error\ is set (misleading wrangler error today).

Fixes #19

Approach

Follows the approach discussed in #19 / @snowyukitty's analysis: no shell, no .cmd\ shim, arguments stay intact (including checkout paths with spaces).

Test plan

  • Windows 10 (10.0.26200), Node v24.16.0, pnpm 11.17.0, path \E:\Projects\cloudflare-os\ (no spaces): \pnpm run-local\ completes install/build and reaches wrangler ready on port 8787
  • Checkout path containing a space (regression case from pnpm run-local cannot start on Windows: spawnSync pnpm ENOENT #19)
  • \pnpm types:generate\ on Windows

CLA

I have read the CLA Document and I hereby sign the CLA

On Windows, execFileSync(pnpm, ...) fails because pnpm is a .cmd shim (ENOENT/EINVAL). Use pnpm's JS entry from npm_execpath when launched via pnpm run so argv survives intact, including paths with spaces.

Fixes cloudflare#19

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@Sainigurnoor511

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pnpm run-local cannot start on Windows: spawnSync pnpm ENOENT

1 participant