forked from Huliangyi/DesktopCommanderMCP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
52 lines (43 loc) · 1.39 KB
/
install.sh
File metadata and controls
52 lines (43 loc) · 1.39 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
49
50
51
52
#!/bin/bash
# Exit on error
set -e
# Function to print error
print_error() {
echo "❌ Error: $1" >&2
}
# Function to print success
print_success() {
echo "✅ $1"
}
# Check if Node.js is installed
if command -v node &> /dev/null; then
NODE_VERSION=$(node -v | cut -d 'v' -f 2)
NODE_MAJOR_VERSION=$(echo "$NODE_VERSION" | cut -d '.' -f 1)
if [ "$NODE_MAJOR_VERSION" -lt 18 ]; then
print_error "Detected Node.js v$NODE_VERSION, but v18+ is required. Please upgrade Node.js."
exit 1
else
echo "Node.js v$NODE_VERSION detected. Continuing..."
fi
else
echo "Node.js not found. Installing Node.js v22.14.0..."
mkdir -p /tmp/nodejs-install
curl -fsSL -o /tmp/nodejs-install/node-v22.14.0.pkg https://nodejs.org/dist/v22.14.0/node-v22.14.0.pkg
sudo installer -pkg /tmp/nodejs-install/node-v22.14.0.pkg -target /
if command -v node &> /dev/null; then
rm -rf /tmp/nodejs-install
print_success "Node.js v22.14.0 installed successfully."
else
print_error "Node.js installation failed. Visit https://nodejs.org to install manually."
exit 1
fi
fi
# Run the setup
echo "Running setup command..."
if npx @wonderwhy-er/desktop-commander@latest setup; then
print_success "Setup completed successfully!"
else
print_error "Setup failed. Check the console output above for more information."
exit 1
fi
exit 0