Skip to content

The agent that grows with you

fix(install): capture npm output on failure for diagnosable errors (#87340)

RelaxJonhf887819421e8
diff --git a/scripts/install.sh b/scripts/install.sh
index 041bce87589..6c0b5d22168 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -2308,11 +2308,21 @@ install_node_deps() {
# A failed npm install used to still print "✓ Node.js dependencies
# installed", hiding the degradation from the user (#77003). Now it
# fails the install outright instead of burying the warning (#85297).
- if ! run_with_timeout "$NODE_DEPS_TIMEOUT" npm install --silent; then
+ # Capture npm output so failures are diagnosable (#87340).
+ local npm_log
+ npm_log="$(mktemp)"
+ if ! run_with_timeout "$NODE_DEPS_TIMEOUT" npm install --silent \
+ >"$npm_log" 2>&1; then
log_error "npm install failed or timed out; Node.js dependencies were not installed"
+ if [ -s "$npm_log" ]; then
+ log_error "npm output:"
+ cat "$npm_log" >&2
+ fi
+ rm -f "$npm_log"
restore_dirty_lockfiles "$INSTALL_DIR"
return 1
fi
+ rm -f "$npm_log"
log_success "Node.js dependencies installed"
# Install Playwright browser + system dependencies.
@@ -2414,11 +2424,21 @@ install_node_deps() {
# Time-boxed: a stalled registry fetch would otherwise hang here (#39219).
# Report success only on actual success, same as node-deps above
# (#77003) — and fail the install outright (#85297).
- if ! run_with_timeout "$NODE_DEPS_TIMEOUT" npm install --silent; then
+ # Capture npm output so failures are diagnosable (#87340).
+ local tui_npm_log
+ tui_npm_log="$(mktemp)"
+ if ! run_with_timeout "$NODE_DEPS_TIMEOUT" npm install --silent \
+ >"$tui_npm_log" 2>&1; then
log_error "TUI npm install failed or timed out; TUI dependencies were not installed"
+ if [ -s "$tui_npm_log" ]; then
+ log_error "npm output:"
+ cat "$tui_npm_log" >&2
+ fi
+ rm -f "$tui_npm_log"
restore_dirty_lockfiles "$INSTALL_DIR"
return 1
fi
+ rm -f "$tui_npm_log"
log_success "TUI dependencies installed"
fi