fix: robust node.js version parsing in installers
Improved Node.js version check logic to handle prefixed version strings and avoid brittle cut commands. Verified with multiple version formats including v24.11.1.
This commit is contained in:
@@ -179,10 +179,18 @@ function Install-Dependencies {
|
||||
# Check Node.js
|
||||
$nodeCmd = Get-Command node -ErrorAction SilentlyContinue
|
||||
if ($nodeCmd) {
|
||||
$version = & node --version
|
||||
Write-ColorOutput "Node.js found: $version" -Type Success
|
||||
$nodeFullVersion = & node --version
|
||||
$nodeMajorVersion = ($nodeFullVersion -replace '^v', '') -split '\.' | Select-Object -First 1
|
||||
|
||||
if ([int]$nodeMajorVersion -lt 18) {
|
||||
Write-ColorOutput "Node.js version $nodeMajorVersion is too old! Node.js 18 or newer is required." -Type Error
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-ColorOutput "Node.js found: $nodeFullVersion" -Type Success
|
||||
} else {
|
||||
Write-ColorOutput "Node.js not found. Some features may not work." -Type Warning
|
||||
Write-ColorOutput "Node.js not found. Node.js 18 or newer is required to install Claude Code." -Type Error
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Check Git
|
||||
|
||||
Reference in New Issue
Block a user