How to install and update NodeJs in Ubuntu.

I will share in the short term how you can install and update NodeJs on the Ubuntu machine.

As simple as the concept I will be sharing is, I had a hard time with it some time ago.

Install NodeJs

 sudo apt install nodejs

now that you have installed NodeJs, you may need to check the version of what you have installed.

Check Node Version

node -v

Check NPM Version

npm -v

Updating NodeJs

there are many ways to do this, but I will explain the simplest and the shortest way.

sudo npm install -g n
sudo n lts

The above command helps you update your version of Node and npm, if you need to read more about updating or installing NodeJs you can read more here.