From 4e5a4eda1f6f2f67db80a534fd52095eecd2df94 Mon Sep 17 00:00:00 2001 From: Renato Date: Tue, 28 Jul 2026 00:57:05 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20npm=20ci=20hangs=20=E2=80=94=20clean=20n?= =?UTF-8?q?ode=5Fmodules,=20add=20timeout,=20install=20build-essential?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - rm -rf node_modules before npm ci (clean from aborted runs) - 420s timeout on npm ci (kills if stuck on native module compilation) - Install build-essential + python3 for better-sqlite3 native addon - Exit with clear error if npm ci fails --- install.sh | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index a019805..a4a003a 100755 --- a/install.sh +++ b/install.sh @@ -138,13 +138,29 @@ log "Data directory ready" STANDALONE_DIR="$INSTALL_DIR/.next/standalone" +# ── Build dependencies (build-essential for native modules) ── +if ! command -v g++ &>/dev/null; then + info "Installing build tools (needed for native modules)..." + case "$OS" in + ubuntu|debian) sudo apt install -y -qq build-essential python3 ;; + arch|endeavouros) sudo pacman -S --noconfirm base-devel python ;; + fedora|centos|rhel|*) sudo dnf groupinstall -y "Development Tools" && sudo dnf install -y python3 ;; + esac + log "Build tools installed" +fi + # ── Build (skip if already built) ────────────────── if [ -f "$STANDALONE_DIR/server.js" ]; then info "Build already exists — skipping" else - info "Installing npm dependencies..." + info "Installing npm dependencies (may take 1-5 min)..." cd "$INSTALL_DIR" - npm ci + rm -rf node_modules 2>/dev/null || true + if ! timeout 420 npm ci 2>&1; then + err "npm ci failed. Check npm registry access or try manually:" + err " cd $INSTALL_DIR && npm ci" + exit 1 + fi log "Dependencies installed" info "Building Next.js app (this may take a few minutes)..."