fix(desktop): find linuxbrew node for the WSL backend - #7827
Conversation
The remote node resolver repairs PATH when a login shell does not expose node, but its fallback list only covered macOS Homebrew (/opt/homebrew/bin, /usr/local/bin). Homebrew on Linux installs to /home/linuxbrew/.linuxbrew/bin, which brew shellenv typically adds only in .bashrc, so login shells - and therefore the WSL backend probe and SSH remotes - reported node as missing even when a satisfying version was installed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Adds the linuxbrew bin path to the existing list of directories searched for node on WSL. The change follows the established pattern exactly and includes a corresponding test assertion. You can add or adjust custom eligibility rules. Learn more. |
What Changed
Additional path for Homebrew on Linux was added, so that node installed via brew on all platforms (not just mac) will be detected as a fallback.
Why
I use Windows through WSL. After turning on the WSL backend, I got the "WSL backend couldn't start" message due to missing
node. I had node installed via Homebrew for Linux. The brew install only adds the path to~/.bashrc, so the login shell didn't have node on the path either. Homebrew on Mac was already covered in theensure_remote_node_pathfor this exact case.Note that
/home/linuxbrew/.linuxbrew/binis a fixed path for all installs. This is the static directory that brew uses for all Linux installs - it is the direct equivalent of/opt/homebrew/bin. In otherwords it isn't anything specific to my setup, machine, or a hallucinated placeholder.Checklist
Workaround
If others encounter this issues add
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"to your bash profile.Note
Low Risk
Small PATH fallback addition in remote shell scripts; no auth, data, or protocol changes.
Overview
Remote SSH/WSL node discovery now also looks in
/home/linuxbrew/.linuxbrew/bin, the default Linux Homebrew prefix, next to the existing macOS Homebrew path.This lets non-interactive remote shells find Node installed via brew on Linux (including WSL) when brew is only on
~/.bashrcand not on the login PATH. A unit assertion covers the new path in the generated runner script.Reviewed by Cursor Bugbot for commit 7f73186. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add Linuxbrew bin path to
ensure_remote_node_pathfor WSL backendPrepends
/home/linuxbrew/.linuxbrew/binto the PATH sequence thatensure_remote_node_pathsearches when locating a usable Node.js on the remote host. This lets the WSL backend discover a Linuxbrew-installed node. Updates the corresponding test assertion in tunnel.test.ts.Macroscope summarized 7f73186.