From 675606b5c42f56a200243e797973a1faeeb3f225 Mon Sep 17 00:00:00 2001 From: Bookworm Bot Date: Sun, 12 Apr 2026 13:59:54 +0900 Subject: [PATCH] =?UTF-8?q?fix(auto-setup):=20npm/npx=20Start-Process=20?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=20Windows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Windows 上 Start-Process "npm" 会匹配到无扩展名的 Unix shell 脚本 而非 npm.cmd,导致 "%1 不是有效的 Win32 应用程序" 错误。 在 Run-CmdWithUI 函数入口自动将 npm/npx 映射为 npm.cmd/npx.cmd, 一劳永逸覆盖所有调用点。 Co-Authored-By: Claude Opus 4.6 --- auto-setup.ps1 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/auto-setup.ps1 b/auto-setup.ps1 index 0b3acab..20f35ff 100644 --- a/auto-setup.ps1 +++ b/auto-setup.ps1 @@ -237,6 +237,11 @@ function Run-CmdWithUI { [int]$timeoutMs = 180000, # 默认 3 分钟 [switch]$captureOutput # 返回 stdout 内容 ) + # W-01: Windows Start-Process 兼容 — npm/npx 无扩展名是 Unix shell 脚本 + if ($exe -in @("npm", "npx") -and -not $exe.EndsWith(".cmd")) { + $exe = "$exe.cmd" + } + # B1: 脱敏日志 (去除 URL 内嵌凭证 user:pass@) $sanitizedArgs = ($arguments -join ' ') -replace '://[^@]+@', '://***@' Bw-Log "CMD" "$exe $sanitizedArgs"