fix: force clean dependency install to resolve path-to-regexp error

- Stop the service before updating dependencies
- Remove node_modules directory to force clean install
- Add Express version verification after install
- This ensures old Express 4.21.x dependencies are completely removed

The service recovery was masking the real issue - old node_modules
were not being updated properly, keeping the problematic Express version.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
courtmanr@gmail.com
2025-05-31 14:48:53 +01:00
parent bf7d85a2e3
commit 2f9c94f45e
+18
View File
@@ -2205,6 +2205,18 @@ case "$INSTALL_MODE" in
print_info "Installing NPM dependencies in $PULSE_DIR..."
cd "$PULSE_DIR" || { print_error "Failed to cd to $PULSE_DIR before npm install"; exit 1; }
# Stop the service before updating dependencies
if systemctl is-active --quiet "$SERVICE_NAME" 2>/dev/null; then
print_info "Stopping $SERVICE_NAME before updating dependencies..."
systemctl stop "$SERVICE_NAME" || true
fi
# Clean up node_modules to ensure fresh install
if [ -d "node_modules" ]; then
print_info "Removing old node_modules directory..."
rm -rf node_modules
fi
# Use npm ci for clean install based on package-lock.json
print_info "Performing clean install of dependencies..."
if ! npm ci --omit=dev 2>&1 | grep -v "^npm WARN"; then
@@ -2218,6 +2230,12 @@ case "$INSTALL_MODE" in
print_success "NPM dependencies installed."
fi
# Verify Express version
local express_version=$(npm list express --depth=0 2>/dev/null | grep express@ | sed 's/.*express@//')
if [ -n "$express_version" ]; then
print_info "Express version installed: $express_version"
fi
print_info "Building CSS assets in $PULSE_DIR..."
if ! npm run build:css --silent; then
print_error "Failed to build CSS assets. See output above."