fix(setup.sh): add Node.js and npm version check before install

This commit is contained in:
XuVIIJay committed 2026-05-15 21:03:28 +08:00
1 parent 02d8b39d75
commit 5728209573
1 file changed
+15
+15
View File
@@ -19,6 +19,21 @@ echo ""
echo "Log file: $LOG_FILE" echo "Log file: $LOG_FILE"
echo "" echo ""
# ---- Check Node.js ----
if ! command -v node &>/dev/null; then
echo "[ERROR] Node.js not found. Please install Node.js 20+ from https://nodejs.org"
echo " or https://nodejs.cn/ (China mirror)."
exit 1
fi
echo "[OK] Node.js $(node -v)"
if ! command -v npm &>/dev/null; then
echo "[ERROR] npm not found."
exit 1
fi
echo "[OK] npm v$(npm -v)"
echo ""
# ---- Detect China network ---- # ---- Detect China network ----
USE_MIRROR=0 USE_MIRROR=0
MIRROR_REGISTRY="https://registry.npmjs.org" MIRROR_REGISTRY="https://registry.npmjs.org"