Node.js Package Manager
Node Package Manager provides two main functionalities:
- It provides online repositories for node.js packages/modules which are searchable on search.nodejs.org
- It also provides command line utility to install Node.js packages, do version management and dependency management of Node.js packages.
The npm comes bundled with Node.js installables in versions after that v0.6.3. You can check the version by opening Node.js command prompt and typing the following command:
Installing Modules using npm
Following is the syntax to install any Node.js module:
Global vs Local Installation
By default, npm installs dependency in local mode. Here local mode specifies the folder where Node application is present. For example if you installed express module, it created node_modules directory in the current directory where it installed express module.
You can use npm ls command to list down all the locally installed modules.
Open the Node.js command prompt and execute "npm ls":