-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
48 lines (40 loc) · 1.24 KB
/
Copy pathinstall.sh
File metadata and controls
48 lines (40 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env zsh
# Void Dependency Installation Script
# Purpose: Configure Node.js environment and install dependencies
echo "========================================"
echo " Void Dependency Installation"
echo "========================================"
echo ""
# Step 1: Verify Node.js version
echo "[1/3] Verifying Node.js version..."
NODE_VERSION=$(node --version 2>/dev/null)
if [[ $? -ne 0 ]]; then
echo "Error: Node.js not found. Please install Node.js v22.18.0 via 'sudo n 22.18.0'"
exit 1
fi
REQUIRED="v22.18.0"
if [[ "$NODE_VERSION" != "$REQUIRED" ]]; then
echo "Warning: Current Node.js is $NODE_VERSION, expected $REQUIRED"
echo "Switching to Node.js $REQUIRED via n..."
sudo n 22.18.0
if [[ $? -ne 0 ]]; then
echo "Error: Node.js version switch failed"
exit 1
fi
fi
NODE_VERSION=$(node --version)
echo "Success: Current Node.js version: $NODE_VERSION"
echo ""
# Step 2: Install dependencies
echo "[2/2] Installing dependencies..."
echo ""
npm install
if [ $? -ne 0 ]; then
echo ""
echo "Error: Dependency installation failed"
exit 1
fi
echo ""
echo "========================================"
echo " Installation completed successfully!"
echo "========================================"