Installing Node.js v10/v12 & NPM on Ubuntu 19.04 for Angular 8 Development

Node.js is a platform for building server side applications and command line tools using JavaScript. In this post, we'll be looking at how to install Node.js 12, Node.js 11 and Node.js 10 LTS in our Ubuntu 19.04 system. Node.js makes use of NPM to install and manage packages which will be also installed when you install Node.

Note: These instructions are also valid for Ubuntu 18.04

Why Do we Use Node.JS for Angular?

Angular is a frontend client-side JS framework so it's not based on Node.js which is a server-side platform for building web apps but you will often need to install Node.js in your Angular development environment because Angular CLI, the official tool for generating and working with Angular projects is built on top of Node.

Node.js is required for Angular develoment but it's not necessary in production after your build your Angular project which will produce plain JavaScript files that can be executed by a web browser.

Nowadays, modern frameworks and libraries like Angular, React or Vue all have some sort of a CLI or Command-Line Interface that makes it easy to generate projects that can be served locally without much configurations or particularly dealing with complex build tools like Webpack.

Besides being a server-side platform, Node has also emerged as a convenient platform for building Command Line Interfaces thanks to its rich package ecosystem that contains over 900,000 packages in the npm registry.

What is the Angular CLI?

Angular CLI is the official command-line interface tool for Angular develoment that you use to initialize, develop, scaffold, and maintain Angular applications. Since, it's buit on top of Node.js, you can install it from NPM using the following commad after you install Node.js on your system (See the instructions below):

$ npm install -g @angular/cli

How to Install Node.js 10 LTS and NPM v5.8 on Ubuntu 19.04?

You can install Node 10 LTS using the official PPA, so you don't need to add anything except running the following command in your terminal:

$ sudo apt-get install Node.js

You'll be prompted for your sudo password, enter it and hit Enter.

Wait for the installation to finish and run the following command in your terminal to verify the installed version:

$ node -v

You should get v10.15.2.

Install Node.js 10 On Ubuntu 19.04

NPM doesn't come installed with Node so you'll need to separately install it. In your terminal, run the following command:

$ sudo apt-get install npm

After finishing the installation, run the following command to verify the installed version:

$ npm -v

You should get v5.8.0.

How to Install Node.js 11 & NPM 6.7 on Ubuntu 19.04?

With the official Ubuntu 19.04 PPA, you'll get Node 10.x LTS version installed but what if you want a newer version? You simply need to add the PPA for the version you want to install.

In you terminal, run the following command:

curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -

If cURL is not installed on your system, simply run the following command:

$ sudo apt install curl

Finally, you need to run the following command to install Node.js 11.x and npm:

$ sudo apt-get install -y nodejs 

Now, if you run:

$ node -v

You should get v11.15.0

You'll also get v6.7.0 of NPM installed.

How to Install Node.js 12 & NPM on Ubuntu 19.04?

In the same way, we can install Node v12 on our Ubuntu system. In you terminal, add the following PPA:

$ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -

The command will also run the the apt update command for you to update your system packages.

Next, run the following command:

$ sudo apt-get install -y nodejs 

You should have Node v12.4.0 and NPM v6.9.0 installed on your system.

Install Node.js on Ubuntu 19.04 Happy coding!

Installing Node.js Using NVM

You can also use NVM for installing Node.js on your Ubuntu system. NVM stands for Node Version Manager and it's simply a POSIX-compliant bash script for installing and managing multiple active Node.js versions.

Open a terminal and start by installing the script using either cURL or wget:

$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash

Next, you can run the following command to list the available Node versions:

$ nvm ls-remote

Next, you can choose a specific version and install it using the following command:

$ nvm install 10.15.2

This will install Node.js 10 LTS on your Ubuntu system.

Installing Node.js from the Official Website

You can simply head over to the official website and download the required binary for your system. There are binaries for Linux/Ubuntu, macOS and Windows both for 64bit and 32bit processors.

Installing Node.js via a Package Manager

You can refer to the official docs for instructions on how to use the official package manager in your system (In our case, Ubuntu) to install Node.js.

Conclusion

Throughout this post, we have seen why we need to use Node.js for Angular 8 development and how we can install Node v10 LTS, Node v11 and Node v12 and NPM (Node Package Manager) on our Ubuntu 19.04 system. These instructions also work on Ubuntu 18.04 LTS.

Note: We also publish our tutorials on Medium and DEV.to. If you prefer reading in these platforms, you can follow us there to get our newest articles.

You can reach the author via Twitter:

About the author

Ahmed Bouchefra
is a web developer with 5+ years of experience and technical author with an engineering degree on software development. You can hire him with a click on the link above or contact him via his LinkedIn account. He authored technical content for the industry-leading websites such as SitePoint, Smashing, DigitalOcean, RealPython, freeCodeCamp, JScrambler, Pusher, and Auth0. He also co-authored various books about modern web development that you can find from Amazon or Leanpub


Get our Learn Angular 8 in 15 Easy Steps ebook in pdf, epub and mobi formats, plus a new Angular 8 tutorial every 3 days.


Online Courses (Affiliate)

If you prefer learning with videos. Check out one of the best Angular courses online
Angular 8 - The Complete Guide (2019+ Edition)

Angular Crash Course for Busy Developers

comments powered by Disqus
DMCA.com Protection Status