From 5485503b426c06c86f5ac3775ad58f620657d35e Mon Sep 17 00:00:00 2001 From: Nik Shevchenko Date: Thu, 11 Jun 2026 00:49:47 -0400 Subject: [PATCH] fix(desktop): fall back to official Node when local node binary is not self-contained (#7802) prepare-agent-runtime.sh --local-node copies the developer's node binary into Desktop/Sources/Resources/node, but Homebrew's node is a thin stub dynamically linked to libnode.X.dylib via @rpath, so the copied binary aborts with dyld 'Library not loaded' at startup. Validate that the staged copy can actually run; when it can't, fall back to the existing checksum-verified official Node download (stage_universal_node). Static builds (official tarballs, nvm) stage locally exactly as before. Co-Authored-By: Claude Fable 5 --- desktop/scripts/prepare-agent-runtime.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/desktop/scripts/prepare-agent-runtime.sh b/desktop/scripts/prepare-agent-runtime.sh index 9c934bf5434..51bc2ce1bfc 100755 --- a/desktop/scripts/prepare-agent-runtime.sh +++ b/desktop/scripts/prepare-agent-runtime.sh @@ -125,7 +125,18 @@ stage_local_node() { cp -f "$node_bin" "$NODE_RESOURCE" chmod +x "$NODE_RESOURCE" xattr -cr "$NODE_RESOURCE" 2>/dev/null || true - log "Staged local Node $("$NODE_RESOURCE" --version) from $node_bin" + + # Homebrew's node is a stub dynamically linked to libnode.dylib via @rpath, + # so the copied binary aborts at startup outside its install prefix. Fall back + # to the self-contained official build when the staged copy can't run alone. + local staged_version + if ! staged_version="$("$NODE_RESOURCE" --version 2>/dev/null)"; then + log "Local Node at $node_bin is not self-contained (dynamically linked, e.g. Homebrew); falling back to official Node $NODE_VERSION download" + rm -f "$NODE_RESOURCE" + stage_universal_node + return + fi + log "Staged local Node $staged_version from $node_bin" } download_node_archive() {