Skip to content

fix(build): collect-npm-licences could not run on Windows - #233

Merged
johan-bell merged 1 commit into
mainfrom
fix-npm-licences-windows
Sep 3, 2026
Merged

fix(build): collect-npm-licences could not run on Windows#233
johan-bell merged 1 commit into
mainfrom
fix-npm-licences-windows

Conversation

@johan-bell

Copy link
Copy Markdown
Collaborator

Dispatching the Windows installer workflow for the first time found this immediately.

Error: spawnSync npm ENOENT
⨯ Command failed: node scripts/collect-npm-licences.mjs …\resources\LICENSES-npm.txt
npm error Lifecycle script `package:win` failed

execFileSync does not consult PATHEXT, so the bare name npm cannot be resolved on Windows, where the executable is npm.cmd. Packaging died in the licence collector — before electron-builder was reached — which is why that workflow has never produced an installer.

One line: process.platform === 'win32' ? 'npm.cmd' : 'npm'. Named explicitly rather than shell: true, which would drag quoting rules into it for no benefit.

Verified the collector still runs on macOS: 286 packages walked, LICENSES-npm.txt written.

This also means the electron/releaseapp-electron/release upload-path fix in #232 has still never been exercised — the job failed two steps before it. Both are on the path to the first Windows build.

execFileSync does not consult PATHEXT, so the bare name 'npm' is ENOENT
on Windows, where the executable is npm.cmd. Packaging died there —
before electron-builder was reached — which is why the Windows installer
workflow had never produced an installer.

Found by dispatching that workflow for the first time.
@johan-bell
johan-bell merged commit 1031ee6 into main Sep 3, 2026
9 checks passed
@johan-bell
johan-bell deleted the fix-npm-licences-windows branch September 3, 2026 21:37
johan-bell added a commit that referenced this pull request Sep 3, 2026
#233 named the executable npm.cmd, which fixed ENOENT and earned EINVAL
instead: since Node 20.12 (CVE-2024-27980) spawning a .cmd without a
shell is refused outright. A shell is what resolves it.

The arguments are fixed flags with nothing to quote, which is why the
quoting objection in #233 was the wrong reason to avoid this.
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