fix(install): build desktop in 'desktop' stage on macOS/Linux instead of silently skipping (#36134)

The thin installer (apps/bootstrap-installer) drives install.sh stage-by-stage,
each in its own process. The `desktop` stage never called check_node, so the
Hermes-managed Node provisioned earlier (at $HERMES_HOME/node/bin) wasn't on
PATH. install_desktop's `command -v npm` check then failed and the build was
skipped — yet the stage still reported {"ok":true,"skipped":false}, so the
installer showed "Installation Complete" and only failed at the end with
"Couldn't find a built Hermes desktop ... the desktop build step may have been
skipped or failed."

Fix:
- Call check_node in the `desktop` stage (mirrors every other Node-dependent
  stage) so the managed Node is on PATH (or installed).
- Make install_desktop self-provision via check_node and hard-fail (return 1)
  if npm is still unavailable, instead of a silent `return 0`. The desktop
  stage only runs when a build is explicitly requested (--include-desktop), so
  an unavailable toolchain is a real failure, not graceful degradation.

Verified on macOS arm64: the `desktop` stage now builds
release/mac-arm64/Hermes.app, which matches resolve_hermes_desktop_exe, so the
installer's "Launch Hermes" succeeds.
This commit is contained in:
brooklyn!
2026-05-31 19:03:10 -05:00
committed by GitHub
parent 77bb64813c
commit fa4ebaa8b5

View File

@ -2332,9 +2332,19 @@ postinstall_mode() {
install_desktop() {
local desktop_dir="$INSTALL_DIR/apps/desktop"
# The desktop stage only runs when a build is explicitly requested
# (--include-desktop / 'desktop' stage), so a missing toolchain is a hard
# failure, not a silent skip — a silent skip yields a "complete" install
# with no app and a confusing "couldn't find a built desktop" at launch.
# Try the Hermes-managed Node first (check_node adds $HERMES_HOME/node/bin
# to PATH or installs it) before giving up.
if ! command -v npm >/dev/null 2>&1; then
log_warn "Skipping desktop build (Node.js / npm not on PATH)"
return 0
check_node
fi
if ! command -v npm >/dev/null 2>&1; then
log_error "Cannot build desktop app: Node.js / npm unavailable"
log_info "Install Node.js and retry: cd $desktop_dir && npm run pack"
return 1
fi
if [ ! -f "$desktop_dir/package.json" ]; then
log_warn "Skipping desktop build (apps/desktop not present in checkout)"
@ -2472,6 +2482,11 @@ run_stage_body() {
detect_os
resolve_install_layout
require_install_dir
# Each stage runs in its own process, so the Hermes-managed Node
# provisioned during prerequisites/node-deps (at $HERMES_HOME/node/bin)
# isn't on PATH here. check_node re-adds it (or installs if missing)
# so install_desktop can find npm instead of silently skipping.
check_node
install_desktop
;;
complete)