Sunday, November 03, 2019

Install NodeJS and Angular on Windows 10 WSL2

Let's see how under Windows Subsystem for Linux (WSL 2) we can setup NodeJs, Npm and install Angular. So that we can later do our web development projects or trying examples from Angular courses. You can also watch the video on the installation.



We will first enable WSL 2 in order to be able to support and load Linux systems:
launch PowerShell by typing: powershell and with right click run it in administrative mode. Paste the following content which will enable WSL as well as the virtual machine platform:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux 
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
wsl --set-default 2The last line will set the 2nd more performant version of WSL as a default when running OS such as Ubuntu.

Next, we will go to Microsoft's store, download and launch the Ubuntu When launching the application, you might be prompted to restart your computer. Then again try to Launch the ubuntu application by just typing ubuntu. It will ask you to set up a default user and password so you can access the Ubuntu system.

Now it is time to update the local distribution packages with:
sudo apt update && sudo apt dist-upgrade

Installing Angular
Since Ubuntu version provided in WSL is not the latest one, we will go to https://github.com/nodesource/distributions
and then install the latest available node version
curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash - sudo apt-get install -y nodejs


We are ready to install the Angular CLI:
sudo npm i -g @angular/cli
(we install the package globally, so to be able to execute ng command from anywhere inside our system)
Now we can type ng new_project followed by cd new_project and ng serve
You can browse the newly created project under http://localhost:4200

Congratulations!

Subscribe To My Channel for updates