1

how do you specifically install VS Code in WSL 2 using Ubuntu distro. It seems it doesn't work for me. Visual Studio Code is officially distributed as a Snap package in the Snap Store. However, when I try to run:

sudo snap install --classic code # or code-insiders

And then, this happen to me:

enter image description here

Because of this, I have one option, and since I am using Ubuntu, the easiest way to install Visual Studio Code for Ubuntu based distributions is to download and install the .deb package (64-bit), either through the graphical software center if it's available, or through the command line with:

sudo apt install ./<file>.deb
sudo apt install apt-transport-https
sudo apt update

And it is working pretty fine for me, and it was installed and updated correctly:

For sudo apt install ./<file>.deb:

enter image description here

For sudo apt install apt-transport-https: enter image description here

For sudo apt update:

enter image description here

However, the final requirement based on the documentation is to run:

sudo apt install code

But this doesn't work for me as I always receiving this error:

E: unable to locate package code

Am I missing on the documentation? You can check it out here: https://code.visualstudio.com/docs/setup/linux. I am pretty sure I followed the documentation correctly but It doesn't work for me so I actually missed something, maybe out of the documentation.

1

1 Answer 1

2

You don't need the sudo apt install code as you already installed it. Just type code

I get this :

$ code
To use Visual Studio Code with the Windows Subsystem for Linux, please install Visual 
Studio Code in Windows and uninstall the Linux version in WSL. You can then use the 
`code` command in a WSL terminal just as you would in a normal command prompt.
 
Do you want to continue anyway? [y/N] y
To no longer see this prompt, start Visual Studio Code with the environment variable 
DONT_PROMPT_WSL_INSTALL defined.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .