Skip to content

Run npm's JS entry point under node on Windows - #182

Merged
jimhoyd merged 2 commits into
mainfrom
claude/fix-windows-npm-spawn
Sep 19, 2026
Merged

jimhoyd merged 2 commits into
mainfrom
claude/fix-windows-npm-spawn

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 19, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #179, which fixed three of the four Windows failures. The fourth
moved from spawnSync npm ENOENT to spawnSync npm.cmd EINVAL.

Naming npm.cmd was necessary but not sufficient: since the CVE-2024-27980
fix, Node refuses to spawn a .cmd/.bat without shell: true and throws
EINVAL rather than running it.

shell: true would work but means quoting arguments for cmd.exe. This runs
npm's own npm-cli.js under the current Node instead — the idiom
scripts/pack-sources.mjs already uses for exactly this reason. The
non-Windows path is unchanged.

As with #179, this PR's checks are Linux-only by design and cannot confirm the
fix; the push-to-main matrix run is what proves it.

🤖 Generated with Claude Code

jimhoyd and others added 2 commits September 19, 2026 18:30
#179 fixed three of the four Windows failures; test 28 moved from
"spawnSync npm ENOENT" to "spawnSync npm.cmd EINVAL". Naming npm.cmd was
necessary but not sufficient: since the CVE-2024-27980 fix, Node refuses to
spawn a .cmd or .bat without shell: true and throws EINVAL rather than running
it.

`shell: true` would work but means quoting every argument for cmd.exe. Instead
this runs npm's own npm-cli.js under the current Node, which is exactly what
scripts/pack-sources.mjs already does for the same reason. The non-Windows path
is unchanged and still spawns `npm` directly.

I should have reached for the existing idiom the first time: pack-sources.mjs
had already solved this, and matching it immediately would have saved a round
trip through main.

Co-Authored-By: Claude Opus 5 <[email protected]>
They were uncommitted when I switched branches and got swept into this one by
git add -A. They describe the auth and admin package moves and belong with
their release, not with a Windows spawn fix.

Co-Authored-By: Claude Opus 5 <[email protected]>
@jimhoyd
jimhoyd merged commit f08dd11 into main Sep 19, 2026
10 checks passed
@jimhoyd
jimhoyd deleted the claude/fix-windows-npm-spawn branch September 19, 2026 23:45
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.

1 participant