Skip to content

Commit 07e963f

Browse files
committed
fix(desktop): spawn npm.cmd with shell on Windows in ensure-win-natives (execFileSync npm ENOENT broke the Windows release build)
1 parent bf8c1d3 commit 07e963f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

desktop/scripts/ensure-win-natives.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,13 @@ function vendor(target) {
6060
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'jht-native-'))
6161
try {
6262
// npm pack prints the tarball filename on stdout (last non-empty line).
63-
const out = execFileSync('npm', ['pack', target.spec, '--silent'], {
63+
// On Windows npm is npm.cmd and recent Node refuses to spawn .cmd files
64+
// without a shell — hence the shell flag (args are simple, no quoting risk).
65+
const isWin = process.platform === 'win32'
66+
const out = execFileSync(isWin ? 'npm.cmd' : 'npm', ['pack', target.spec, '--silent'], {
6467
cwd: tmp,
6568
encoding: 'utf8',
69+
shell: isWin,
6670
})
6771
const tarball = out.trim().split('\n').filter(Boolean).pop()
6872
fs.rmSync(dest, { recursive: true, force: true })

0 commit comments

Comments
 (0)