What is Node Package Manager?

Node Package Manager is a package manager for the JavaScript language. It’s also called npm. It is the default package manager for Node.js which is a javascript runtime environment.
It was created as an open-source project in 2009 to help javascript developers to share packages(code modules). npm has a large database of packages called npm registry. npm registry is a collection of packages.
Using the npm command line client we can install and publish packages. npm.Inc company hosts and maintains the above operations.
npm is free to use. You can download and install npm packages without any registration.

How to install npm?

You can install npm using Node.js software. You can download and install Node.js from their official website https://nodejs.org/


Updating npm:

You can update npm using the following command.

npm install @latest -g

-g flag updates npm globally.

npm – Commmand Line Client

You can use a command-line client for downloading and installing packages.


npm install

Dependency management:

npm also manages the dependencies of packages. package.json file contains dependencies of packages. Because of these dependencies, you can install all packages required in your project in one command. All packages defined in package.json can be installed using the “npm install” command. package.json file must be written in JSON format.
You can create a package.json file using the following command:

npm init –yes

–yes flag gives default values. You can also create a package.json file manually if you want.

Uninstalling packages:

You can uninstall the npm packages if you don’t want to use it anymore. You can uninstall npm package with the following command:


npm uninstall tinymce


After installing any package, npm creates a copy of it in the .npm directory of your path. So, next time if you are installing the same package then it copies from there. This .npm directory gets covered with old packages over time, so it is good to clean it from time to time.
You can clean the npm cache with the following command:

npm cache clean –force


You can scan your project for vulnerabilities and automatically install any compatible updates for those vulnerable dependencies.
If you want to scan your project for vulnerabilities without directly making changes you can do it with the following command:

npm audit

You can fix project vulnerabilities with the following command:

npm audit fix

Notify of
1 Comment
Newest Most Voted
Inline Feedbacks
View all comments
3 years ago

Superb, what a blog it is! This weblog provides useful data to us, keep it up.