Running VSCode from Ubuntu WSL2 not working

Viewed 1264

I am trying to run VSCode in my Ubuntu WSL2.

When I run code . , zsh is unable to find VSCode. I have installed Remote - WSL plugin in VSCode, and I am able to open my Ubuntu Instance from Windows. I want to achieve it from Ubuntu terminal as well.

ayman@DESKTOP  ~  code .
zsh: command not found: code

I have tried wsl --shutdown and then reinstalling Remote-WSL plugin, but it still does not work.

Is there a zsh configuration required for running VSCode from terminal? If so, what are the configurations required?

1 Answers

If VSCode is in your Windows path, it should be in your WSL path as well. Things to check:

  • Is VSCode in your Windows path? If not, add it there first.

  • Windows path propagation to WSL is enabled by default, but double-check that. Check to see if there's a line there in the [interop] section named appendWindowsPath. If it is set to false, change it to true or just delete the line altogether.

  • Perhaps your startup scripts (e.g. ~/.zshrc) are modifying the path (or setting a new one entirely)? If so, append to the path in your startup scripts rather than replacing it.

  • Any zsh extensions that could be modifying the path?

Related