fix: npm ci hangs — clean node_modules, add timeout, install build-essential
- 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
This commit is contained in:
+18
-2
@@ -138,13 +138,29 @@ log "Data directory ready"
|
|||||||
|
|
||||||
STANDALONE_DIR="$INSTALL_DIR/.next/standalone"
|
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) ──────────────────
|
# ── Build (skip if already built) ──────────────────
|
||||||
if [ -f "$STANDALONE_DIR/server.js" ]; then
|
if [ -f "$STANDALONE_DIR/server.js" ]; then
|
||||||
info "Build already exists — skipping"
|
info "Build already exists — skipping"
|
||||||
else
|
else
|
||||||
info "Installing npm dependencies..."
|
info "Installing npm dependencies (may take 1-5 min)..."
|
||||||
cd "$INSTALL_DIR"
|
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"
|
log "Dependencies installed"
|
||||||
|
|
||||||
info "Building Next.js app (this may take a few minutes)..."
|
info "Building Next.js app (this may take a few minutes)..."
|
||||||
|
|||||||
Reference in New Issue
Block a user