From 2f9c94f45e70fc0b14576e04bbfece310d6576c0 Mon Sep 17 00:00:00 2001 From: "courtmanr@gmail.com" Date: Sat, 31 May 2025 14:48:53 +0100 Subject: [PATCH] fix: force clean dependency install to resolve path-to-regexp error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- scripts/install-pulse.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts/install-pulse.sh b/scripts/install-pulse.sh index fcc0deeeb..09f0af990 100755 --- a/scripts/install-pulse.sh +++ b/scripts/install-pulse.sh @@ -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."