Repository navigation
fix(host): keep fnm's stable Node link in machine services - #6774
Merged
Merged
Conversation
2 of 3 tasks
process.execPath resolves every link, so Homebrew's /opt/homebrew/bin/node became a Cellar version directory that the next `brew upgrade` deletes, and mise/Volta/asdf shims became version directories the same way. Keep the PATH lookup and resolve only fnm's per-shell fnm_multishells link, one level, to aliases/default or the version chosen with `fnm use`. Fixes #6773 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
The POSIX machine installer writes
command -v nodeinto the systemd unit, the launch agent, and the~/.local/bin/bbshim. Under fnm that path goes through a per-shellfnm_multishells/<session>link. On Linux the link lives in$XDG_RUNTIME_DIR(/run/user/<uid>), which is cleared on reboot, so the unit fails with203/EXECand the machine stays offline.The first version of this PR used
process.execPath, which resolves every link. That fixes fnm but regresses stablePATHlinks: Homebrew's/opt/homebrew/bin/nodebecomes/opt/homebrew/Cellar/node/<version>/bin/node, which the nextbrew upgradedeletes. mise, Volta and asdf shims become version folders the same way.Fixes #6773
What changed
apps/server/src/assets/install-machine.sh: keeps thePATHlookup. When it is…/fnm_multishells/<session>/bin/node, the installer reads that session link once and saves its target. Normally that is fnm'saliases/default, so the service followsfnm default; afterfnm use Xit is that version's install folder. Any other path is saved unchanged. Ifreadlinkfails, the installer behaves as before.apps/server/test/app/install-machine-script.test.ts: new test that builds fnm's layout (version install,aliases/default, per-shell link first onPATH) and checks that the systemd unit and the bb shim usealiases/default/bin/node. The existing systemd test now checks that an ordinaryPATHlink (the Homebrew shape) is saved unchanged. The stubsystemctlit shared with the new test is now a helper.How you verified
ExecStart="…/fnm_multishells/476_1793101823158/bin/node" …. After the fix it passes.pnpm exec turbo run test --filter=@bb/server -- test/app/install-machine-script.test.ts: 54/54 pass.pnpm exec turbo run typecheck --filter=@bb/serverpasses, as dosh -nandoxfmt --check.FNM_DIR(fnm install 24,fnm default 24). The per-shell link points toaliases/default, and the installer's new code returns…/aliases/default/bin/node. That path still runs (v24.22.2) after the per-shell link is deleted.install-machine-windows.mjsusesprocess.execPathand is unchanged).🤖 Generated with Claude Code