From f08763c63213e2743cf81e1eba6f7752e57c19f8 Mon Sep 17 00:00:00 2001 From: BowenJXD <132646115+BowenJXD@users.noreply.github.com> Date: Mon, 12 Oct 2026 12:28:18 +1100 Subject: [PATCH] =?UTF-8?q?fix(windows):=20=E4=BF=AE=E5=A4=8D=20Node=20?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=A3=80=E6=B5=8B=E5=9C=A8=20Volta=20?= =?UTF-8?q?=E7=AD=89=E7=8E=AF=E5=A2=83=E4=B8=8B=E8=AF=AF=E6=8A=A5=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E8=BF=87=E6=97=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit start-windows.bat 的版本检测命令中包含 >、? 和 : 等 cmd 元字符。 当 node 由 Volta 等版本管理器的 shim 提供时,参数会经过 cmd 重新解析, 引号保护失效,">=22?0:1)" 被当作输出重定向,导致报错 "The filename, directory name, or volume label syntax is incorrect" 并返回非零退出码,脚本因此误判 Node 版本过旧(即使是 v24 LTS)。 改用不含 cmd 元字符的等价表达式: Math.max(0, Math.sign(22 - parseInt(process.versions.node))) 主版本号 >= 22 时退出码为 0,否则为 1,判断逻辑不变。 --- scripts/start-windows.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/start-windows.bat b/scripts/start-windows.bat index 3aa4521b..192086ee 100644 --- a/scripts/start-windows.bat +++ b/scripts/start-windows.bat @@ -10,7 +10,7 @@ cd /d "%~dp0.." where node >nul 2>nul if errorlevel 1 goto :nonode -node -e "process.exit(Number(process.versions.node.split('.')[0])>=22?0:1)" +node -e "process.exit(Math.max(0, Math.sign(22 - parseInt(process.versions.node))))" if errorlevel 1 goto :oldnode if not exist "node_modules\ws\package.json" (