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:
@@ -178,7 +178,14 @@ install_dependencies() {
|
||||
if ! command -v node &> /dev/null; then
|
||||
log_warn "Node.js not found. Some features may not work."
|
||||
else
|
||||
log_success "Node.js found: $(node --version)"
|
||||
local node_full_version=$(node -v 2>&1)
|
||||
local node_version=$(echo "$node_full_version" | grep -oE '[0-9]+' | head -n1)
|
||||
|
||||
if [ ! -z "$node_version" ] && [ "$node_version" -ge 18 ]; then
|
||||
log_success "Node.js found: $node_full_version"
|
||||
else
|
||||
log_warn "Node.js found but too old ($node_full_version). v18+ recommended."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check Git
|
||||
|
||||
Reference in New Issue
Block a user