fix(windows): 修复 Node 版本检测在 Volta 等环境下误报版本过旧

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,判断逻辑不变。
This commit is contained in:
BowenJXD committed 2026-10-12 12:28:18 +11:00
1 parent bc50cac01f
commit f08763c632
1 file changed
+1 -1
+1 -1
View File
@@ -10,7 +10,7 @@ cd /d "%~dp0.."
where node >nul 2>nul where node >nul 2>nul
if errorlevel 1 goto :nonode 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 errorlevel 1 goto :oldnode
if not exist "node_modules\ws\package.json" ( if not exist "node_modules\ws\package.json" (