From 20231531ab8da53155d45a68556dcb9811785e29 Mon Sep 17 00:00:00 2001 From: Rain <1050807841@qq.com> Date: Mon, 22 Jun 2026 13:35:14 -0700 Subject: [PATCH] fix(desktop): activate hermit on macOS so STDIO extensions resolve node (#9482) Signed-off-by: Pluviobyte Co-authored-by: Pluviobyte --- ui/desktop/src/bin/node-setup-common.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/ui/desktop/src/bin/node-setup-common.sh b/ui/desktop/src/bin/node-setup-common.sh index 9a3a29bc0..86c8da17b 100755 --- a/ui/desktop/src/bin/node-setup-common.sh +++ b/ui/desktop/src/bin/node-setup-common.sh @@ -23,6 +23,12 @@ trap 'log "An error occurred. Exiting with status $?."' ERR log "Starting node setup (common)." +# GUI-launched macOS apps inherit a minimal PATH that omits the system sbin +# directories, so Hermit's bootstrap cannot find tools like `chown` (which lives +# in /usr/sbin on macOS) and aborts with exit 127. Ensure they are reachable; +# this is harmless on Linux, where these paths are typically already present. +export PATH="/usr/sbin:/sbin:${PATH}" + if [ -n "${GOOSE_PATH_ROOT:-}" ]; then RESOLVED_GOOSE_CONFIG_DIR="${GOOSE_PATH_ROOT}/config" elif [ -n "${GOOSE_CONFIG_DIR:-}" ]; then @@ -125,11 +131,13 @@ else log "Hermit environment already initialized. Skipping init." fi -# Activate the environment with output redirected to log -if [[ "$(uname -s)" == "Linux" ]]; then - log "Activating hermit environment." - { . "bin/activate-hermit"; } >> "${LOG_FILE}" 2>&1 -fi +# Activate the environment with output redirected to log. +# Activation must run on every platform: macOS GUI apps otherwise never get the +# hermit-managed node/npx onto PATH, so STDIO extensions fail with +# "env: node: No such file or directory". The Linux-only guard was introduced in +# #5372 to "preserve existing behavior" on macOS, but that path is now broken. +log "Activating hermit environment." +{ . "bin/activate-hermit"; } >> "${LOG_FILE}" 2>&1 # Install Node.js using hermit log "Installing Node.js with hermit."