Node.js and npm Installation on my Ubuntu 20.04.2 LTS

Node.js and npm Installation on my Ubuntu 20.04.2 LTS

Hi folks,

Here I'm going to share how to install Node.js and npm on Ubuntu.

Finally changed my OS from Windows to Ubuntu 20.04.2 LTS. Now I'm going to set up Node.js.

Step 1

First, we have to update our all ubuntu packages by

sudo apt update

Step 2

Next, we have to install Node.js by

sudo apt install nodejs

Installed our Node.js. We can check the version by

nodejs -v

Screenshot from 2021-03-22 13-03-58 (copy).png

Step 3

But we got an older version of Node.js. We can update it by following commands.

Install curl and install our latest Node.js version 14.16.0 by

sudo apt install curl
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -

Again install Node.js and check the version, we got our Node.js latest version!

sudo apt install nodejs
node --version

Screenshot from 2021-03-22 13-04-43 (copy).png

Step 4

We also got our npm version as 6.14.11. But now we are going to update our latest npm version by

sudo npm install -g npm@latest

Screenshot from 2021-03-22 13-30-25 (copy).png

And check the version we got our latest version of npm 7.6.3

npm -v

Screenshot from 2021-03-22 13-30-25 (another copy).png

Happy Learning!!!