← Back to PRs

#6064: fix(daemon): prefer bundled node from install-cli.sh over system node

by joyshmitz open 2026-02-01 07:24 View on GitHub →
gateway
## Summary The gateway install command now checks for bundled Node.js at `~/.openclaw/tools/node/bin/node` (installed by `install-cli.sh`) before falling back to system node paths like `/opt/homebrew/bin/node`. ## Problem There was a disconnect between different components: | Component | Knows about bundled node? | |-----------|---------------------------| | `install-cli.sh` | ✅ Installs and uses it | | macOS app (`CommandResolver.swift:109`) | ✅ Adds to PATH | | CLI `resolvePreferredNodePath()` | ❌ Only checked system paths | This caused `openclaw gateway install` to generate LaunchAgent with Homebrew node instead of the bundled node that `install-cli.sh` installed. ## Changes - Added `resolveBundledNodePath()` to resolve `~/.openclaw/tools/node/bin/node` - Added `resolveBundledNodeInfo()` to check if bundled node exists and is supported - Modified `resolvePreferredNodePath()` to check bundled node first, then fall back to system node - Added tests for all new functionality ## Testing - [x] All existing tests pass - [x] New tests for bundled node resolution - [x] `pnpm tsgo && pnpm format && pnpm lint && pnpm build && pnpm test` passes ## AI Disclosure 🤖 AI-assisted (Claude Code). Fully tested locally. Changes are understood. Fixes #6061 <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR updates the daemon’s Node runtime selection (`src/daemon/runtime-paths.ts`) to prefer a bundled Node installed by `install-cli.sh` at `~/.openclaw/tools/node/bin/node` before falling back to system Node locations, and adds coverage in `src/daemon/runtime-paths.test.ts` for the new bundled-resolution behavior. Net effect: `openclaw gateway install` should now generate launch configuration that targets the bundled Node (when present + supported), aligning CLI behavior with the installer and macOS app PATH handling. <h3>Confidence Score: 4/5</h3> - This PR is generally safe to merge and matches the intended behavior change, with a small platform edge case to consider. - The changes are localized to runtime path resolution, are covered by new tests, and preserve the existing system-node fallback behavior. The main remaining concern is a win32 edge case where `os.homedir()` may not match win32 path semantics when env vars are missing, potentially producing an invalid bundled-node candidate path. - src/daemon/runtime-paths.ts (win32 home directory fallback behavior) <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs