NodeJs Installation - Ubuntu

NodeJs Installation - Ubuntu

Subscribe to my newsletter and never miss my upcoming articles

Listen to this article

Install Node.js and npm on Ubuntu using the official repository

Node.js is available on Ubuntu. So all you need to do is to open a terminal and use the following command:

sudo apt install nodejs

To install npm, use the following command:

sudo apt install npm

I recommend installing npm as well because you're going to need it anyway. Both Node.js and npm are quite small.

Install development tools

To be able to compile and install native add-ons from npm you need to install the development tools. The following command will install all the necessary packages including the GCC compilers :

sudo apt install build-essential

Open a new terminal (you may need restart) and type the below command to verify the installation:

node -v

The console should respond with a version string. Repeat the process for npm:

npm -v

If both commands work, your installation was a success, and you can start using Node.js!

Uninstall NodeJS

If for some reasons you want to uninstall Node.js and npm packages, you can use the following command:

sudo apt remove nodejs npm

Congratulations!! We had successfully installed the Nodejs On Ubuntu : D

Share this