Node Package Manager (NPM) is a repository where you can find JavaScript modules (libraries or functionalities) developed by other users which could be used in your module.

Re-inventing the wheel is often not recommended in the world of software programming and hence you could find generous people sharing what they have already developed for you to reuse in your code and you can find them all in Node Package Manager.

From Version 0.6.3, NPM is included by default in packages and installers. So if you are downloading the latest version of Node then you don’t have to install NPM separately.

How Do I Know If I Have Node Package Manager Installed?

If you have already installed Node then you can just check what version of Node.js and NPM you have by executing the below commands in the “Node.js Command Prompt”

Command to find Node version:

node –v


node –version

Command to find Node Package Manager version:

npm –v


npm –version

Find Node Package Manager Version

Installing Modules Using Node Package Manager

In order to install third party modules we use Node Package Manager. Below is the syntax that helps you to install the modules using NPM.

npm install <module_name>

When you install the modules using Node Package Manager they are placed under node_modules folder (this is in windows) in my case it is located under C:\Users\SriVarshan\AppData\Roaming\npm

There are two ways to install NPM packages either locally or globally.

Install Node Package Manager Package Locally

Locally – If the module that you are planning to install is required just for one project then you can install it locally. You would be using the require command to refer the local module.

Command to Install NPM package locally: npm install coffee-script

Command to Un-install local package: npm uninstall coffee-script

Install Node Package Manager Package Globally

Globally – If you are planning to re-use the module across different projects then you can install the module globally and use npm link command.

Command to Install NPM package Globally: npm install -g coffee-script

Command to Un-install global package: npm uninstall –g coffee-script

Note: If you are still unable to decide whether to install the module locally or globally you can simply install them in both the places, since the size of these JavaScript modules are very less.

Install and Test CoffeScript Using Node Package Manager

If you haven’t heard about CoffeScript before I guess this is the right time to get to know it. Though we won’t be dwelling much into CoffeScript, a simple example would make things clearer to you.

  • Open Node.js command prompt under Node.js folder in Start Menu
  • Type the below command,

npm install -g coffee-script

Coffee Script Editor in Node Package Manager

  • If you now naviagate to the below folder path, you should see a coffee-script folder created.


  • Now that we have installed the coffee-script module let us quickly test it to see if it works,

First type coffee and press enter.

  • You should see the prompt changed to coffee> Now type the below command to get the numbers printed from 1 to 10 in the reverse as shown in the below screenshot.

console.log [10..1]

coffee script example

  • Now to exit from the coffee script prompt press CTRL + C
  • You will see the message – “(^C again to quit)” so press CTRL + C again which will bring you back to normal prompt.
Hope this article helps you to understand what is Node Package Manager and how it can be used to install packages. Stay tuned for more user friendly articles on Node.js here at Artic Post. Share it if you felt that this article was useful to you.