feat: use LTS Node.js version for installation
- Replace hardcoded setup_24.x with setup_lts.x for Linux apt/dnf/yum - Update Windows installer to use Node.js 22 LTS with dynamic version fetch - Update install messages to reflect LTS instead of specific version - Fixes: Node.js 24+ requirement causing installation failures on some systems - Ensures latest LTS version (20.x, 22.x) is used instead of bleeding edge Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -95,12 +95,19 @@ if ($nodeMajor -ge $MIN_NODE_MAJOR) {
|
|||||||
if ((Get-NodeMajor) -ge $MIN_NODE_MAJOR) { $installed = $true }
|
if ((Get-NodeMajor) -ge $MIN_NODE_MAJOR) { $installed = $true }
|
||||||
}
|
}
|
||||||
|
|
||||||
# 3. Direct MSI download — Node.js 20 LTS (most compatible)
|
# 3. Direct MSI download — Node.js 22 LTS (most compatible)
|
||||||
if (-not $installed) {
|
if (-not $installed) {
|
||||||
Write-Host " Downloading Node.js 20 LTS MSI..." -ForegroundColor Yellow
|
Write-Host " Downloading Node.js 22 LTS MSI..." -ForegroundColor Yellow
|
||||||
try {
|
try {
|
||||||
$msiUrl = "https://nodejs.org/dist/v20.18.0/node-v20.18.0-x64.msi"
|
# Try to get latest LTS version dynamically, fallback to known good version
|
||||||
$msiFile = Join-Path $env:TEMP "node-v20-lts.msi"
|
$latestLts = "v22.14.0"
|
||||||
|
try {
|
||||||
|
$releases = Invoke-RestMethod -Uri "https://nodejs.org/dist/index.json" -UseBasicParsing -TimeoutSec 10
|
||||||
|
$lts = $releases | Where-Object { $_.lts -and $_.version -match "^v22\." } | Select-Object -First 1
|
||||||
|
if ($lts) { $latestLts = $lts.version }
|
||||||
|
} catch {}
|
||||||
|
$msiUrl = "https://nodejs.org/dist/$latestLts/node-$latestLts-x64.msi"
|
||||||
|
$msiFile = Join-Path $env:TEMP "node-lts.msi"
|
||||||
Invoke-WebRequest -Uri $msiUrl -OutFile $msiFile -UseBasicParsing
|
Invoke-WebRequest -Uri $msiUrl -OutFile $msiFile -UseBasicParsing
|
||||||
Start-Process msiexec.exe -ArgumentList "/i `"$msiFile`" /quiet /norestart" -Wait
|
Start-Process msiexec.exe -ArgumentList "/i `"$msiFile`" /quiet /norestart" -Wait
|
||||||
Refresh-Path
|
Refresh-Path
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ def install_node():
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
# Linux — nodesource
|
# Linux — nodesource
|
||||||
print(f" Installing Node.js v24 via nodesource...")
|
print(f" Installing Node.js LTS via nodesource...")
|
||||||
try:
|
try:
|
||||||
# Remove old nodesource list if present (prevents version conflicts)
|
# Remove old nodesource list if present (prevents version conflicts)
|
||||||
for old_list in ["/etc/apt/sources.list.d/nodesource.list"]:
|
for old_list in ["/etc/apt/sources.list.d/nodesource.list"]:
|
||||||
@@ -133,7 +133,7 @@ def install_node():
|
|||||||
os.remove(old_list)
|
os.remove(old_list)
|
||||||
|
|
||||||
result = run_cmd(
|
result = run_cmd(
|
||||||
["bash", "-c", "curl -fsSL https://deb.nodesource.com/setup_24.x | bash - && apt-get remove -y nodejs || true && apt-get install -y nodejs"],
|
["bash", "-c", "curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && apt-get remove -y nodejs || true && apt-get install -y nodejs"],
|
||||||
timeout=180, capture_output=True, text=True,
|
timeout=180, capture_output=True, text=True,
|
||||||
)
|
)
|
||||||
if result.returncode == 0:
|
if result.returncode == 0:
|
||||||
@@ -148,7 +148,7 @@ def install_node():
|
|||||||
for pkg_mgr in ["dnf", "yum"]:
|
for pkg_mgr in ["dnf", "yum"]:
|
||||||
if shutil.which(pkg_mgr):
|
if shutil.which(pkg_mgr):
|
||||||
result = run_cmd(
|
result = run_cmd(
|
||||||
["bash", "-c", f"curl -fsSL https://rpm.nodesource.com/setup_24.x | bash - && {pkg_mgr} install -y nodejs"],
|
["bash", "-c", f"curl -fsSL https://rpm.nodesource.com/setup_lts.x | bash - && {pkg_mgr} install -y nodejs"],
|
||||||
timeout=180, capture_output=True, text=True,
|
timeout=180, capture_output=True, text=True,
|
||||||
)
|
)
|
||||||
if result.returncode == 0:
|
if result.returncode == 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user