- Steps
- Install the
Remote development Extension pack on VS Code
- Once you install the extension, you will see a Remote Development extension icon at the bottom left corner of the VS Code editor.Click on the icon, you will get a pop up with a list of options. Click on the first option "Remote-WSL: New Window" for the default distro or select the "Remote-WSL: New Window using Distro" for a specific distro.
- Once installed, the VS Code of your Windows machine/desktop will communicate with VS Code server on the Linux side.
- Install the
- Steps taken to fix
WSL
- Install latest Windows updates
- Install
WSL2
following the docs
- Steps taken to use
docker-compose
inWSL
- Uninstalled and reinstalled docker desktop on windows 10
- Enable the
WSL2
based engine in the settings on docker desktop. - Enable integration with additional distributions under
Resources
on docker desktop.
Based on Fiqri Ismail's Medium article:
-
Use the
nodesource
distribution installer:curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
Find other versions in @nodesource/distributions/deb/
-
Use
apt-get
to installnodejs
:sudo apt-get install -y nodejs
-
Verify that
node
is working:node --version
bash: /mnt/c/Program Files/nodejs/npm: /bin/sh^M: bad interpreter: No such file or directory
If you find your pwd
starts with /mnt/c/…
and you should cd ~/
which will take you to your home folder inside WSL
which you want to be using instead when hacking on code.
You are likely hitting a problem with importing your Windows PATH
environment variable into WSL2
.
See microsoft/WSL#1890.
Important Notice: Refer to @microsoft/WSL #1890 before making the following changes.
-
Open
~/.bashrc
in your editor:code ~/.bashrc
-
Append the following line in the end:
PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g') # strip out problematic Windows %PATH%
-
If you still run into the problem with some commands you might wan to consider this approach:
### remove unnecessary Win PATHs # This can prevent extension-less commands from bleeding into BASH. # (eg. "ng" would execute the Win bin if "@angular/cli" wasn't installed on Linux.) # function path_remove { # Delete path by parts so we can never accidentally remove sub paths PATH=${PATH//":$1:"/":"} # delete any instances in the middle PATH=${PATH/#"$1:"/} # delete any instance at the beginning PATH=${PATH/%":$1"/} # delete any instance in the at the end } path_remove '/mnt/c/Users/me/AppData/Roaming/npm' path_remove '/mnt/c/Users/me/AppData/Local/Yarn/bin' path_remove '/mnt/c/Program Files (x86)/Yarn/bin' path_remove '/mnt/c/Program Files/Git' path_remove '/mnt/c/Program Files/Git/cmd' path_remove '/mnt/c/Program Files/nodejs' path_remove '/mnt/c/OpenSSL-Win32/bin' path_remove '/mnt/c/Program Files (x86)/Python27'
See this comment.