2026 OpenClaw MCP Node runtime mismatches: why nvm works in Terminal but MCP subprocesses crash with ENOENT on a rented ProxyMac Mac mini
Teams deploying OpenClaw with custom MCP servers on Mac mini M4 rentals spread across Hong Kong, Japan, Korea, Singapore, and the United States frequently paste stderr showing /usr/bin/env: node: No such file or directory while Node v22 prints perfectly inside Terminal.app. The culprit is not “OpenClaw broke”; it is multiple Node installations shadowing each other, only one of which launchd-backed gateways inherit. This manual teaches (1) how upstream stacks increasingly assume modern Node semantics for MCP transports, (2) a symptom hash table mapping errno strings to fixes, (3) why nvm hooks never execute under LaunchAgents, (4) a nine-step audit ladder pairing with PATH & Homebrew, environment variables, and upgrade rollback, plus (5) Corepack edge cases when MCP shells invoke pnpm dlx. Quantitative anchors include Node 22 feature gates, 120-second restart storms, and zero tolerance for implicit dotfile reliance in regulated fleets.
The runtime split: interactive shells versus LaunchAgent planets
Interactive zsh sessions happily source nvm.sh, prepend Homebrew Apple Silicon paths, and expose Corepack shims. launchd starts OpenClaw with a sparse environment—often only /usr/bin:/bin:/usr/sbin:/sbin—unless your plist enumerates additions. MCP servers inherit whatever their parent gateway inherited; therefore #!/usr/bin/env node shebangs explode when env cannot locate node on that PATH slice.
- Observable metric: capture both
node -p process.execPathfrom Terminal and from a tiny LaunchAgent echo job—disagreement exceeding one path component warrants immediate plist edits. - ABI failures: mixing arm64 binaries with Rosetta shells surfaces as obscure V8 crashes rather than clean ENOENT—still runtime mismatch.
- Parallel installs: Homebrew
/opt/homebrew/bin/node, manually downloaded pkg, and nvm-managed builds can coexist; CI copied JSON referencing only one breaks elsewhere.
/etc/proxymac-node.channel listing semver + checksum—operators resolve ambiguous tickets 35% faster when that exists.
Symptom hash table: errno strings for MCP operators
| Log fingerprint | Likely cause | First corrective move |
|---|---|---|
env: node: No such file | PATH missing brew/nvm prefix | Add absolute PATH stanza or symlink under /usr/local/bin |
Error: Cannot find module 'node:fs' | Very old Node trying to parse modern import maps | Upgrade to ≥22 LTS channel per platform guidance |
MODULE_NOT_FOUND inside MCP worker | NODE_PATH absent for daemon | Use explicit workingDirectory or bundle deps |
spawn EBADF after upgrade | Mixed partial installs | Rollback via rollback playbook |
Why sourcing nvm.sh is the wrong production contract
nvm delays Node downloads behind shell functions—fantastic for humans, fragile for midnight automation. Instead install one blessed interpreter path referenced directly by MCP JSON or wrap with /bin/bash -lc only after threat modeling injection risks. Combine with secrets hygiene from Keychain guidance so wrappers do not leak tokens via set -x.
Nine-step runtime audit ladder
- Freeze deployments: pause CI merges until diagnostics finish—avoid thrashing
launchctl kickstart. - Dump effective PATH: instrument LaunchAgent temporarily to log sorted env (protected file).
- Compare Node builds: run
node -p "[process.version, process.arch]"in both contexts. - Normalize MCP JSON: replace relative interpreter hints with absolute exec paths.
- Align Corepack: enable once globally with pinned package managers—document versions.
- Cross-check OpenClaw upgrades: follow upgrade matrix.
- Tail JSONL: correlate stderr lines using logging guide.
- Validate ulimit: massive monorepos occasionally exhaust fds—see ulimits.
- Publish RCA: record regions impacted (HK / JP / KR / SG / US) and semver endpoints.
.zshrc into plist ProgramArguments—reviewers cannot diff security regressions sensibly.
Corepack, pnpm, and MCP entrypoints that spawn package managers
When MCP definitions call pnpm dlx or yarn node, Corepack must be enabled consistently—interactive shells often complete setup prompts launchd never sees. Bake non-interactive flags and mirror caches under service-owned directories so HK and US replicas behave identically.
FAQ
Will Docker erase this pain? Containers pin OS images yet still require you to choose a Node base tag—same semver discipline.
Does Apple Silicon matter? Yes—fat binaries built on Intel laptops mis-target arm64 minis.
Where do SSH sessions fit? Manual SSH inherits login shells; gateway processes do not—treat SSH tests as hints, not contracts.
Why ProxyMac Mac mini matches disciplined Node pinning
Rented Mac mini M4 hosts across HK / JP / KR / SG / US give teams deterministic Apple Silicon environments without procurement delays—ideal when MCP gateways must track upstream Node cadence monthly. Pair hardware rental from the pricing page with operational docs in the help center; use VNC when GUI installers must click through Gatekeeper prompts interactively.
Ship MCP with one blessed Node binary
OpenClaw · MCP · HK / JP / KR / SG / US