While Apple is the standard for developers, Microsoft has taken strides to improve the experience of developing on a Windows machine. First and foremost among these steps is their support for Windows Subsystem for Linux.
In this repo are instructions for setting up:
- Windows Subsystem for Linux
- Git for Windows
- Git for WSL
- Node and NPM
- Java [TODO]
- Docker [TODO]
-
Download Ubuntu from the Microsoft Store App on your Windows machine or follow this link: https://www.microsoft.com/en-us/p/ubuntu/9nblggh4msv6
-
WSL is an optional feature on Windows, it disabled by default so we'll need to enable it.
- Open your start menu and search for "Windows Features"
- Select "turn windows features on or off"
- Scroll down and check the box labeled "Windows Subsystem for Linux"
- Hit OK - It may take a minute because we are installing the Linux File System on our OS.
- Restart
If you have issues with the above steps you can still enable WSL through a different method.
- Open Powershell as an administrator - Start -> Search for "Powershell" -> Right click, Run as Administrator
- Execute the following command by pasting it into Powershell:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
- Once it finishes executing you'll be give an option to Restart your machine, which you will need to do.
- When your computer reboots open up the Ubuntu app that we downloaded earlier by opening your start menu and searching "Ubuntu" or by checking the top left area of your start menu where recently installed apps are located.
- A terminal style window should open up with the words "Installing..."
- When this finishes congratulations! You can now run Bash from the start menu, Powershell, the command prompt, or whatever terminal emulator you like!
Depending on your needs you may need to set up Git twice: once for your Windows CMD and once for your Linux WSL shell. If you plan to do all your work through the WSL then skip to Installing Git for WSL.
- Download the Git for Windows installer from https://git-scm.com/download/win
- Run the installer and follow the instructions.
You'll be given a lot of options as you progress through the installer. We suggest sticking with the default options.
- To download and install Git open Ubuntu and execute the following command
sudo apt install git
You will need to enter your password whenever you use the sudo
command.
The
sudo
command allows you to run programs with the security priveledges of another user, by default the superuser. It stands for "superuser do".
You may also want to supply some config information for Git to use.
git config --global user.name "Ash Coca"
git config --global user.email ash.coca@email.com
This is an optional step, but will make things a little faster when you're pushing and pulling from Github.
-
Install cURL (a tool used for downloading content from the internet in the command-line) with:
sudo apt-get install curl
-
Next we'll want to install NVM (Node Version Manager) This utility will allow you to manage multiple versions of node should you need to in the future. Execute this line:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
-
To verify installation, enter:
nvm -v
...this should return 'nvm', if you receive 'command not found' or no response at all, close your current terminal, reopen it, and try again.
Now we're ready to install Node!
- Install the latest stable LTS release of Node.js (recommended):
nvm install --lts
You can optionally installing a specific version of node with
nvm install <version>
or the current version of node withnvm install node
- Verify your install by entering
node -v
- We'll also want to verify our install of NPM (Node Package Manager - included with node) with
npm -v
If you installed multiple versions of node using NVM, you can view these installs with
nvm ls
You can also use
which node
andwhich npm
to see the path used for the default versions of these tools.To change the version of Node.js you would like to use for a project, create a new project directory
mkdir NodeTest
, and enter the directorycd NodeTest
, then enternvm use node
to switch to the Current version, ornvm use --lts
to switch to the LTS version. You can also use the specific number for any additional versions you've installed, likenvm use v8.2.1
. (To list all of the versions of Node.js available, use the command:nvm ls-remote
).
If you're using Windows 10 v2004 or later you may want to upgrade to WSL2. This adds a number of features that you can read about here: WSL2 Docs
To enable WSL2, we'll need to first enable the Virtual Machine Platform optional component.
-
Open powershell
-
Execute the following command:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
You will still need to restart even though we're adding the
/norestart
flag.
-
Once your machine restarts, you'll need to open powershell again.
-
Execute the following command:
wsl --set-default-version 2