openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
20 lines (19 loc) • 809 B
JavaScript
import { t as stableHomebrewNodePathCandidates } from "./stable-node-path-dXOexVJv.js";
import fs from "node:fs/promises";
//#region src/infra/stable-node-path.ts
/**
* Homebrew Cellar paths (e.g. /opt/homebrew/Cellar/node/25.7.0/bin/node)
* break when Homebrew upgrades Node and removes the old version directory.
* Resolve these to a stable Homebrew-managed path that survives upgrades:
* - Default formula "node": <prefix>/opt/node/bin/node or <prefix>/bin/node
* - Versioned formula "node@22": <prefix>/opt/node@22/bin/node (keg-only)
*/
async function resolveStableNodePath(nodePath) {
for (const candidate of stableHomebrewNodePathCandidates(nodePath)) try {
await fs.access(candidate);
return candidate;
} catch {}
return nodePath;
}
//#endregion
export { resolveStableNodePath as t };