Home > Enterprise >  Problem with $PATH environment variable in VS-Code (WSL2)
Problem with $PATH environment variable in VS-Code (WSL2)

Time:11-18

Anything Homebrew related stopped working in VS Code bash terminal. I could find out that this is probably related to $PATH environment variable as echo $Path in VS Code misses anything related to "linuxbrew"

/home/tfendt/.vscode-server/bin/f4af3cbf5a99787542e2a30fe1fd37cd644cc31f/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:

while echo $PATH in terminal outside VS-Code

/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

shows the correct paths and everything is working as expected.

As far as I can tell, these are the only differences in $Path.

Setup:

  • WSL2-Ubuntu
  • Homebrew on Linux 3.3.3
  • VS Code 1.62.1 with Remote-WSL extension

I have recently updated to VS Code 1.62.1 and Homebrew 3.3.3

As this was working out of the box before, I would like to find out what is causing the different behaviour now. I'm not sure if this is a VS Code issue, WSL-related or if I need to have a look at my Homebrew-Setup. As this goes to deep for my still basic knowledge of anything WSL and VS Code related, any suggestions or hints for further research are greatly appreciated.

CodePudding user response:

The problem was related to a bug introduced in VS Code 1.62.1:

After updating from 1.62.0 to 1.62.1, the full shell environment under WSL2 isn't loaded.

This seems solved as of now in 1.62.2

Further information: https://github.com/microsoft/vscode/issues/136791

  • Related