Node js npm
NPM stands for Node Package Manager. NPM comes with the Node.js. It is installed with node installation. The npm package management system helps us to download and install the Node.js client API and its dependencies. It is an online repository for publishing of open source node.js project. This is the best thing about npm that it keeps all the dependencies local.
Checking the npm version
For this, go to start, and launch command prompt. On command prompt type the following command.
Along with npm version, you will also notify to upgrade the npm, if new upgrade available.
Install a package
To install a package via npm , we use the npm install command. This technique requires only the name of the module package you want to install.
Suppose, we want to download a package called 'colors', for this open the command prompt and run the following command.
npm install colors
All the installed package is placed inside 'node_modules' directory by npm. This directory is created by npm at the time of first package installation.
Example of colors package
var colors = require('colors/safe'); console.log(colors.yellow('Node colors package.'));
Output of the above code