-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfix-server-package.sh
More file actions
executable file
·46 lines (34 loc) · 1.08 KB
/
fix-server-package.sh
File metadata and controls
executable file
·46 lines (34 loc) · 1.08 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
#!/bin/bash
# Fix package.json on server to remove macOS-specific SWC package
SERVER="207.180.203.243"
VPS_FRONTEND_PATH="/var/www/decleanup/frontend"
echo "🔧 Fixing package.json on server..."
echo ""
# Upload fixed package.json
echo "📤 Uploading fixed package.json..."
scp frontend/package.json root@${SERVER}:${VPS_FRONTEND_PATH}/package.json
echo ""
echo "🧹 Cleaning up and reinstalling on server..."
ssh root@${SERVER} << 'EOF'
cd /var/www/decleanup/frontend
# Remove node_modules and package-lock.json to force fresh install
echo "Removing old dependencies..."
rm -rf node_modules package-lock.json
# Remove the problematic package if it exists
echo "Cleaning npm cache..."
npm cache clean --force
# Install dependencies (will auto-select correct SWC for Linux)
echo "Installing dependencies..."
npm install
# Rebuild
echo "Building Next.js app..."
npm run build
# Restart PM2
echo "Restarting PM2..."
pm2 restart decleanup || pm2 start npm --name decleanup -- start
echo ""
echo "✅ Done!"
EOF
echo ""
echo "📋 Check logs:"
echo " ssh root@${SERVER} 'pm2 logs decleanup'"