Laurent Couvidou Laurent Couvidou - 6 months ago 34
Node.js Question

Find the version of an installed npm package

How to find the version of an installed node.js/npm package?

This prints the version of npm itself:

npm -v <package-name>


This prints a cryptic error:

npm version <package-name>


This prints the package version on the registry (i.e. the latest version available):

npm view <package-name> version


How do I get the installed version?

Answer

npm list for local packages or npm list -g for globally installed packages.

The result should look like (package@version):

├─┬ cli-color@0.1.6 
│ └── es5-ext@0.7.1 
├── coffee-script@1.3.3 
├── less@1.3.0 
├─┬ sentry@0.1.2 
│ ├── file@0.2.1 
│ └── underscore@1.3.3 
└── uglify-js@1.2.6 

Edit: As @juanpaco pointed out it is now possible to directly display the version of one package if you know the name of the package.

For example: npm list grunt will result in:

projectName@projectVersion /path/to/project/folder
└── grunt@0.4.1
Comments