#!/bin/bash # CentOS 7 启动脚本(Node.js 16.x) set -e cd "$(dirname "$0")/.." if ! command -v node >/dev/null 2>&1; then echo "[ERROR] node not found. Install Node.js 16.x first." exit 1 fi NODE_MAJOR=$(node -p "process.versions.node.split('.')[0]") if [ "$NODE_MAJOR" -lt 16 ]; then echo "[ERROR] Node.js 16+ required. Current: $(node -v)" exit 1 fi echo "Starting with Node $(node -v) ..." exec node server.js