From 63825661f394686009ccb2400c5252dc6489d296 Mon Sep 17 00:00:00 2001 From: Johan Bell Date: Thu, 3 Sep 2026 23:35:50 +0200 Subject: [PATCH] fix(build): collect-npm-licences could not run on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- scripts/collect-npm-licences.mjs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/collect-npm-licences.mjs b/scripts/collect-npm-licences.mjs index 95bc693..a0c7830 100644 --- a/scripts/collect-npm-licences.mjs +++ b/scripts/collect-npm-licences.mjs @@ -38,8 +38,12 @@ const LICENCE_FILE = /^(LICEN[CS]E|COPYING|NOTICE)(\..*)?$/i; * since `files` takes node_modules minus devDependencies. */ function productionTree() { + // `npm` is `npm.cmd` on Windows, and execFileSync does not consult PATHEXT — + // so the bare name is ENOENT there, which failed packaging on a Windows runner + // before it reached electron-builder. + const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm'; const json = execFileSync( - 'npm', + npm, ['ls', '--omit=dev', '--all', '--json', '--long'], { cwd: APP_ELECTRON, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 } );