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 <noreply@anthropic.com>
This commit is contained in:
+12
-1
@@ -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
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"engines": {
|
||||
"node": ">=20.19"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
|
||||
Reference in New Issue
Block a user