From ad10cacc7920fb66bbdc8a904590b2b9d7adb608 Mon Sep 17 00:00:00 2001 From: shulaoda <165626830+shulaoda@users.noreply.github.com> Date: Thu, 25 Jun 2026 22:12:22 +0800 Subject: [PATCH] fix(create-void): spawn package managers with a shell on Windows --- packages/create-void/src/pm.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/create-void/src/pm.ts b/packages/create-void/src/pm.ts index dd07753bf..b568defb1 100644 --- a/packages/create-void/src/pm.ts +++ b/packages/create-void/src/pm.ts @@ -38,7 +38,11 @@ export function pmExec(pm: PM): ReadonlyArray { export function run(argv: ReadonlyArray, cwd?: string): Promise { return new Promise((resolve, reject) => { const [cmd, ...args] = argv; - const child = spawn(cmd, args, { stdio: 'inherit', cwd }); + // On Windows the package-manager entry points (npm, npx, pnpm, yarn, bunx) + // are .cmd/.ps1 shims that spawn() cannot resolve without a shell, so it + // throws ENOENT. Enable a shell only on win32; every arg here is a fixed + // literal (no user input reaches argv), so there is no injection surface. + const child = spawn(cmd, args, { stdio: 'inherit', cwd, shell: process.platform === 'win32' }); child.on('close', (code) => { if (code === 0) { resolve();