What is: NPM

NPM (Node Package Manager) is a free dependency manager for JavaScript projects. Initially, it was built for NodeJS, but it’s becoming a tool that people use to put JavaScript together on the frontend. It has a giant repository with hundreds of thousands of packages and modules.

With NPM you can specify all of your project’s necessary components in a package.json file. It’s also possible to define what versions your project depends upon to prevent updates from breaking your project. This way, when you or a developer needs to get started with your project they can just run npm install and immediately have all of the dependencies installed.

You can use NPM from the command line to install, uninstall or update packages, then you can load them modularly in your script. For example, if you run the following command in your project folder, NPM will download the required package into node_modules directory:

npm install a-nice-package --save

Then you can load the package in your JavaScript like this:

var package = require('a-nice-package');



Recent articles