From 34986b5760ef648e7e6644a37e8bf746c62250be Mon Sep 17 00:00:00 2001 From: Nate Emmert Date: Tue, 10 Mar 2026 15:00:45 -0400 Subject: [PATCH] Harden update script dependency install flow --- update-server.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/update-server.sh b/update-server.sh index 5bf5987..faaa142 100644 --- a/update-server.sh +++ b/update-server.sh @@ -12,8 +12,18 @@ echo "📥 Pulling latest code..." git pull origin main echo "📦 Installing dependencies..." -rm -rf node_modules package-lock.json -npm ci --only=production 2>&1 | tail -20 +rm -rf node_modules + +# Prefer deterministic installs with npm ci when lockfile is present. +if [ -f package-lock.json ]; then + if ! npm ci --omit=dev 2>&1 | tail -20; then + echo "npm ci failed, falling back to npm install..." + npm install --omit=dev 2>&1 | tail -20 + fi +else + echo "No package-lock.json found, using npm install..." + npm install --omit=dev 2>&1 | tail -20 +fi echo "🔄 Restarting application..." pm2 restart resource-monitor