From accf645a42c88e58ab14230abee5445d31b4ddea Mon Sep 17 00:00:00 2001 From: jon Date: Thu, 23 Jul 2026 16:18:35 -0500 Subject: [PATCH] fix(install): install Node 20 on Linux; Vite needs it Debian apt ships EOL Node 18 which crashes Vite 8. Prep stage installs Node 20 from NodeSource when node is missing or <20; package.json declares engines. Co-Authored-By: Claude Opus 4.8 --- bin/restore-linux.sh | 13 ++++++++++++- interface/web/package.json | 3 +++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/bin/restore-linux.sh b/bin/restore-linux.sh index 30c19ca..27407d7 100644 --- a/bin/restore-linux.sh +++ b/bin/restore-linux.sh @@ -35,8 +35,19 @@ if [ "$stage" = "prep" ]; then echo "Installing system packages..." sudo apt-get install -y --no-install-recommends \ git sqlite3 curl python3-venv python3-gi gir1.2-gtk-3.0 \ - nodejs npm xfce4-genmon-plugin plank blueman \ + xfce4-genmon-plugin plank blueman \ || echo "Warning: some system packages failed — install them manually." + + # Node.js 20+: Vite needs 20.19+, but Debian/Ubuntu apt ship an EOL Node 18 + # (its 'nodejs' package) which crashes Vite with 'CustomEvent is not defined'. + # Install from NodeSource only when the current node is missing or too old. + node_major=$(node -v 2>/dev/null | sed -E 's/^v([0-9]+).*/\1/') + if [ -z "$node_major" ] || [ "$node_major" -lt 20 ]; then + echo "Installing Node.js 20 (found: ${node_major:-none})..." + curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - \ + && sudo apt-get install -y nodejs \ + || echo "Warning: Node 20 install failed — install Node 20+ manually (Vite needs it)." + fi fi exit 0 fi diff --git a/interface/web/package.json b/interface/web/package.json index 67cf7f4..80940ba 100644 --- a/interface/web/package.json +++ b/interface/web/package.json @@ -3,6 +3,9 @@ "private": true, "version": "1.0.0", "type": "module", + "engines": { + "node": ">=20.19" + }, "scripts": { "dev": "vite", "build": "vite build",