a blog for those who code

Friday 25 December 2015

Find Version of Installed NPM package

In this post we will be discussing about how to find the version of an installed npm package. When you install a npm package either it is installed globally or it is installed locally. So in this post we will show you how to find the version of npm local and global package.

To find the version of all local packages you should use npm list whereas to find the version of all global packages you should use npm list -g which will list out all the packages with all the dependencies as shown below.


If you want to know the version of one package and if you know the name of the package you can use npm list <packagename> -g (for example : npm list grunt -g)


If the package is installed both locally and globally and you are trying to use npm list <packagename> in the local folder you might get an error like npm ERR! extraneous as shown below. This error means that package is installed but it is not listed in your's project's package.json.


If you just want to see all the packages version without their dependent version you can use npm list --depth=0 -g or npm list --depth=0 which will give output as follows.


Please Like and Share the CodingDefined.com blog, if you find it interesting and helpful.

No comments:

Post a Comment