Assert right node version before starting services

This commit is contained in:
Abhishek 2026-04-22 15:25:41 +00:00
parent 00a1a22b74
commit 28d9039594
2 changed files with 35 additions and 0 deletions

View file

@ -182,6 +182,22 @@ if ! pgrep -x nginx >/dev/null 2>&1; then
fi
log_info "nginx is running"
# Verify Node >= 22.6 (required by api/mcp_server/ts_validator)
if ! command -v node >/dev/null 2>&1; then
log_error "node is not installed. api/mcp_server/ts_validator requires Node >= 22.6."
log_error "Install via: curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - && sudo apt-get install -y nodejs"
exit 1
fi
NODE_VERSION=$(node -v | sed 's/^v//')
NODE_MAJOR=${NODE_VERSION%%.*}
NODE_MINOR=$(echo "$NODE_VERSION" | cut -d. -f2)
if [[ $NODE_MAJOR -lt 22 ]] || { [[ $NODE_MAJOR -eq 22 ]] && [[ $NODE_MINOR -lt 6 ]]; }; then
log_error "Node $NODE_VERSION is too old. api/mcp_server/ts_validator requires Node >= 22.6."
log_error "Upgrade via: curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - && sudo apt-get install -y nodejs"
exit 1
fi
log_info "node $NODE_VERSION is new enough"
###############################################################################
### PHASE 1: RUN MIGRATIONS
###############################################################################

View file

@ -61,6 +61,25 @@ if [[ -d "$RUN_DIR" ]]; then
fi
fi
###############################################################################
### 1c) Verify Node >= 22.6 (required by api/mcp_server/ts_validator)
###############################################################################
if ! command -v node >/dev/null 2>&1; then
echo "ERROR: node is not installed. api/mcp_server/ts_validator requires Node >= 22.6."
echo "Install via: curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - && sudo apt-get install -y nodejs"
exit 1
fi
NODE_VERSION=$(node -v | sed 's/^v//')
NODE_MAJOR=${NODE_VERSION%%.*}
NODE_MINOR=$(echo "$NODE_VERSION" | cut -d. -f2)
if [[ $NODE_MAJOR -lt 22 ]] || { [[ $NODE_MAJOR -eq 22 ]] && [[ $NODE_MINOR -lt 6 ]]; }; then
echo "ERROR: Node $NODE_VERSION is too old. api/mcp_server/ts_validator requires Node >= 22.6."
echo "Upgrade via: curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - && sudo apt-get install -y nodejs"
exit 1
fi
echo "Node $NODE_VERSION detected (>= 22.6 required)"
###############################################################################
### 2) Define services
###############################################################################