Linux Mint

Install NPM on Linux Mint 21

NPM is a useful package manager for JavaScript. It consists of a CLI client and an NPM registry. It allows you to gracefully handle all the packages while working with JavaScript. Today, we will see how we can install NPM on a Linux Mint 21 system.

How to install NPM on Linux Mint 21?

To install NPM on Linux Mint 21, the steps given below should be performed:

Step # 1: Install nodejs on Your System

The first step is to install nodejs on your system because without having it installed, you cannot proceed with the NPM installation. To install nodejs on Linux Mint 21, you have to execute the following command:

$ sudo apt install nodejs

The output shown below represents a successful installation of nodejs on our system.

Step # 2: Confirm the nodejs Installation on Your System

The installation of nodejs on Linux Mint 21 can be confirmed with the following command:

$ nodejs --version

The image displaying the output of this command below confirms the nodejs installation.

Step # 3: Install NPM on Your System

Now, we can install NPM on our system with the help of the following command:

$ sudo apt install npm

The image shown below depicts the successful installation of NPM on Linux Mint 21.

Step # 4: Confirm the NPM Installation on Your System

You can also confirm the NPM installation on your system by executing the following command:

$ npm --version

The display of the NPM version in the image shown below confirms its installation.

Pro-Tip

After working with NPM, whenever you wish to remove it along with nodejs from your system, you can simply execute the following command:

$ sudo apt-get purge --autoremove nodejs npm

Conclusion

By following the procedure shared above, you can easily have NPM installed on your Linux Mint 21 system and then you will be able to manage your JavaScript packages very easily.

About the author

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.