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
var package = require('a-nice-package');