Steps to Install Miniconda and Serverless on Windows Debian Terminal and VS Code

Installation

To get started, you need to:

  1. 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 glibc dependencies in native source code inside the extension. See the Remote Development and Linux article for details.
  2. 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 code command.
  3. 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.

  1. Open a WSL terminal window (using the start menu item or by typing wsl from a command prompt / PowerShell).
  2. Navigate to a folder you’d like to open in VS Code (including, but not limited to, Windows filesystem mounts like /mnt/c)
  3. Type 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.
  4. 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.
  5. 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

  1. Download the installer:
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

2. In your terminal window, run:

  • Miniconda:
bash Miniconda3-latest-Linux-x86_64.sh
  1. Follow the prompts on the installer screens.If you are unsure about any setting, accept the defaults. You can change them later.
  2. To make the changes take effect, close and then re-open your terminal window.
  3. 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.

export PATH=”/home/your_username/miniconda/bin:$PATH”

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

  1. Open your bash terminal.
  2. Install cURL (a tool used for downloading content from the internet in the command-line) with: sudo apt-get install curl
  3. Install nvm, with: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
  1. 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.
  2. List which versions of Node are currently installed (should be none at this point): nvm ls
  3. Install the current release of Node.js (for testing the newest feature improvements, but more likely to have issues): nvm install node

Install Serverless

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 npm i

References

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.