1

My computer crashed and I had to reinstall my system today. I'm running Windows 10 with VS Code and I'm using Debian (WSL) as my main terminal.

I have installed VS Code with the "Add to PATH" option and I have activated the Windows Subsystem for Linux in PowerShell.

I can use the command "code" in CMD and PowerShell but when I try to run it in Debian I get "-bash: code: command not found", as far as I understand it should work straight away when installing with the "path" option? At least according to this article: https://dev.to/ajeet/the-ultimate-guide-to-use-vs-code-with-windows-subsystem-for-linux-wsl-51hc

I have also tried installing the "Remote Development" extension, but I'm still facing the same problem.

3 Answers 3

3

Try adding the following line to the .bashrc file in your $HOME directory (~/.bashrc).

PATH=$PATH:/mnt/c/Users/$USER/AppData/Local/Programs/Microsoft\ VS\ Code/bin

Where you replace $USER with your Windows username.

Sign up to request clarification or add additional context in comments.

Comments

1

Alternatively, you can create an alias and add it to your .bashrc file:

alias $COMMAND"$PATH"

Where you replace $COMMAND with a name of your choice and $PATH with the path to the executable.

Comments

0

You can set an alias in bashrc like:

alias code='code --remote wsl+<distro_name>'

Where distro_name is your WSL distro name.

You can check your distro name in PowerShell by using:

wsl --list

Refer to the documentation.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.