To get started, you need to:
- Install the Windows Subsystem for Linux along with your preferred Linux distribution.Note: WSL 1 does have some known limitations for certain types of development. Also, extensions installed in Alpine Linux may not work due to
glibcdependencies in native source code inside the extension. See the Remote Development and Linux article for details.
- Install Visual Studio Code on the Windows side (not in WSL).Note: When prompted to Select Additional Tasks during installation, be sure to check the Add to PATH option so you can easily open a folder in WSL using the
- Install the Remote Development extension pack.
Open a remote folder or workspace
FROM THE WSL TERMINAL
Opening a folder inside the Windows Subsystem for Linux in VS Code is very similar to opening up a Windows folder from the command prompt or PowerShell.
- Open a WSL terminal window (using the start menu item or by typing
wslfrom a command prompt / PowerShell).
- Navigate to a folder you’d like to open in VS Code (including, but not limited to, Windows filesystem mounts like
code .in the terminal. When doing this for the first time, you should see VS Code fetching components needed to run in WSL. This should only take a short while and is only needed once. Note: If this command does not work, you may need to restart your terminal, or you may not have added VS Code to your path when it was installed.
- After a moment, a new VS Code window will appear, and you’ll see a notification that VS Code is opening the folder in WSL. VS Code will now continue to configure itself in WSL and keep you up to date as it makes progress.
- Once finished, you now see a WSL indicator in the bottom left corner, and you’ll be able to use VS Code as you would normally!
Installing on Linux
- Download the installer:
2. In your terminal window, run:
- Follow the prompts on the installer screens.If you are unsure about any setting, accept the defaults. You can change them later.
- To make the changes take effect, close and then re-open your terminal window.
- Test your installation. In your terminal window or Anaconda Prompt, run the command
conda list. A list of installed packages appears if it has been installed correctly.
If you have already installed Miniconda and cannot run the commands in the terminal while using bash, you may find the following helpful.
In case you have already added the appropriate path environment variable to bashrc and bash_profile files, you would need to add the Miniconda folder directory to the PATH environment variable of bash shell.
The line which contains the string /home/your_username/miniconda would need to be replaced with your actual path. Once done, save and quit the terminal.
Install nvm, node.js, and npm
- Open your bash terminal.
- Install cURL (a tool used for downloading content from the internet in the command-line) with:
sudo apt-get install curl
- Install nvm, with:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
- To verify installation, enter:
command -v nvm…this should return ‘nvm’, if you receive ‘command not found’ or no response at all, close your current terminal, reopen it, and try again. Learn more in the nvm github repo.
- List which versions of Node are currently installed (should be none at this point):
- Install the current release of Node.js (for testing the newest feature improvements, but more likely to have issues):
nvm install node
npm install -g serverless
To mount C:/ with default permissions bound to user instead of root. You can followed the guide here: https://devblogs.microsoft.com/commandline/chmod-chown-wsl-improvements/
sudo umount /mnt/c sudo mount -t drvfs C: /mnt/c -o metadata,uid=1000,gid=1000,umask=22,fmask=111
This mounts all files on the C drive as user instead of root. Therefore, sudo is not needed to run
- Developing in the Windows Subsystem for Linux with Visual Studio Code