mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 17:58:28 +00:00
fix(daemon): prefer current node (process.execPath) and add macOS version manager paths to service PATH
On macOS, `openclaw gateway install` hardcodes the system node (/opt/homebrew/bin/node) in the launchd plist, ignoring the node from version managers (fnm/nvm/volta). This causes the Gateway to run a different node version than the user's shell environment. Two fixes: 1. `resolvePreferredNodePath` now checks `process.execPath` first. If the currently running node is a supported version, use it directly. This respects the user's active version manager selection. 2. `buildMinimalServicePath` now includes version manager bin directories on macOS (fnm, nvm, volta, pnpm, bun), matching the existing Linux behavior. Fixes #18090 Related: #6061, #6064
This commit is contained in:
@@ -152,10 +152,24 @@ export async function resolvePreferredNodePath(params: {
|
||||
runtime?: string;
|
||||
platform?: NodeJS.Platform;
|
||||
execFile?: ExecFileAsync;
|
||||
execPath?: string;
|
||||
}): Promise<string | undefined> {
|
||||
if (params.runtime !== "node") {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Prefer the node that is currently running `openclaw gateway install`.
|
||||
// This respects the user's active version manager (fnm/nvm/volta/etc.).
|
||||
const currentExecPath = params.execPath ?? process.execPath;
|
||||
if (currentExecPath) {
|
||||
const execFileImpl = params.execFile ?? execFileAsync;
|
||||
const version = await resolveNodeVersion(currentExecPath, execFileImpl);
|
||||
if (isSupportedNodeVersion(version)) {
|
||||
return currentExecPath;
|
||||
}
|
||||
}
|
||||
|
||||
// Fall back to system node.
|
||||
const systemNode = await resolveSystemNodeInfo(params);
|
||||
if (!systemNode?.supported) {
|
||||
return undefined;
|
||||
|
||||
Reference in New Issue
Block a user