fix: Windows scripts check Node.js version, use winget OpenJS.NodeJS.V24

BAT and PS1 now detect if installed Node is < v24 and suggest/install
the correct v24 package instead of LTS (v22).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
delta-cloud-208e
2026-02-21 14:04:36 +00:00
parent 2c00e0327d
commit bb708e5650
2 changed files with 25 additions and 6 deletions

View File

@@ -31,9 +31,17 @@ if errorlevel 1 (
where node >nul 2>&1
if errorlevel 1 (
echo WARNING: Node.js not found. Updater will attempt to guide you.
echo Install: winget install OpenJS.NodeJS
echo WARNING: Node.js not found.
echo Install: winget install OpenJS.NodeJS.V24
echo or: https://nodejs.org/
) else (
for /f "tokens=1 delims=." %%A in ('node -v') do set "NODE_MAJOR=%%A"
set "NODE_MAJOR=!NODE_MAJOR:v=!"
if !NODE_MAJOR! LSS 24 (
echo WARNING: Node.js v!NODE_MAJOR! found, need v24+
echo Upgrade: winget install OpenJS.NodeJS.V24
echo or: https://nodejs.org/
)
)
REM ---- Pull latest artifacts ----

View File

@@ -42,11 +42,22 @@ if (-not $hasPython) {
}
}
# Node.js
if (-not (Test-Command "node")) {
# Node.js v24+
$nodeOk = $false
if (Test-Command "node") {
$nodeVer = (node --version) -replace '^v', ''
$nodeMajor = [int]($nodeVer -split '\.')[0]
if ($nodeMajor -ge 24) {
$nodeOk = $true
} else {
Write-Host " Node.js v$nodeVer found, need v24+. Upgrading..." -ForegroundColor Yellow
}
} else {
Write-Host " Node.js not found." -ForegroundColor Yellow
if (-not (Install-WithWinget "OpenJS.NodeJS" "Node.js")) {
Write-Host " Install manually: https://nodejs.org/" -ForegroundColor Yellow
}
if (-not $nodeOk) {
if (-not (Install-WithWinget "OpenJS.NodeJS.V24" "Node.js v24")) {
Write-Host " Install Node.js v24+ manually: https://nodejs.org/" -ForegroundColor Yellow
}
}