DEV Community

Cover image for VSCode with WSL2 - Solve the not connecting bug.
Ramon Lima
Ramon Lima

Posted on

VSCode with WSL2 - Solve the not connecting bug.

The Issue

I don't know if you ever had this issue, hopefully not but you're trying to connect to your WSl2 instance and it's saying it's not able to connect, etc. Some people on the internet will tell you to restart and that might work for sometime but then it will come back again the same issue and always restarting will not solve forever.

WSL2 Cleanup

Cleanup all the current connections within WSL2.

  1. Open you WSL2 distro you're trying to connect to and then go into the following folder: cd ~/.vscode-server/bin/
  2. Remove all the folders there: rm -rf ./*

Windows VSCode Cleanup

On the newest version of the VSCode it automatically does this cleanup by default but it's always good to double check just in case and see if there's any conflicting versions of "ms-vscode-remote.remote-wsl-*", if there's more then one version there please delete the other folders which are older versions or remove remote wsl and reinstall it from the extensions tab in VSCode.

  1. Open CMD: WIN + R
  2. Type in: cmd
  3. Go into the vscode extensions dir: cd %userprofile%\.vscode\extensions
  4. See the folders: dir


Thank you make sure to give your like on this article if it helped you or if it saved your day with VSCode and WSL2.

Top comments (0)