fix: include linuxbrew node path in MCP runtime fallbacks

Fixes #705

GUI launches of the AppImage on Linux do not inherit the shell PATH, so
`find_on_path` and `find_in_user_shell` cannot reach Homebrew-on-Linux's
Node install. Add the canonical Linuxbrew paths to `fallback_node_paths`
and to `node_binary_candidates_for_home`; `.is_file()` filtering keeps
machines without Linuxbrew unaffected.
This commit is contained in:
Matt Van Horn
2026-05-19 23:23:58 -07:00
parent 6cf77f9b94
commit 0abf7b492a

View File

@@ -228,6 +228,9 @@ fn fallback_node_paths() -> Vec<PathBuf> {
PathBuf::from("/usr/local/bin/node"),
];
#[cfg(not(windows))]
candidates.push(PathBuf::from("/home/linuxbrew/.linuxbrew/bin/node"));
#[cfg(windows)]
{
if let Some(program_files) = std::env::var_os("ProgramFiles") {
@@ -267,6 +270,7 @@ fn node_binary_candidates_for_home(home: &Path) -> Vec<PathBuf> {
home.join(".mise").join("shims").join(node_binary_name()),
home.join(".asdf").join("shims").join(node_binary_name()),
home.join(".volta").join("bin").join(node_binary_name()),
home.join(".linuxbrew").join("bin").join(node_binary_name()),
];
let nvm_dir = home.join(".nvm").join("versions").join("node");
@@ -999,6 +1003,7 @@ mod tests {
home.join(".local/share/mise/shims/node"),
home.join(".asdf/shims/node"),
home.join(".volta/bin/node"),
home.join(".linuxbrew/bin/node"),
];
for candidate in expected {