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)..."