node.js npm package

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?


  • 16

    On my installation, “npm -v <package-name>” reports the version of npm, itself. To list the latest version of a package in the registry, I have found that “npm view <package-name> version” gets the job done.

    Apr 29, 2018 at 20:25

  • 24

    npm show shows the latest in npm, not installed

    Aug 26, 2019 at 16:18

  • 2

    most of the time <module-name> -v should work. However, this depends on whether or not the package developer(s) added cli functionality to their packages.

    – Nate T

    Dec 21, 2020 at 7:39


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

You can find the version of a specific package by passing its name as an argument. For example, npm list grunt will result in:

[email protected] /path/to/project/folder
└── [email protected]

Alternatively, you can just run npm list without passing a package name as an argument to see the versions of all your packages:

├─┬ [email protected] 
│ └── [email protected] 
├── [email protected] 
├── [email protected] 
├─┬ [email protected] 
│ ├── [email protected] 
│ └── [email protected] 
└── [email protected] 

You can also add --depth=0 argument to list installed packages without their dependencies.


  • 149

    On mac and linux it’s nice to add ” | grep module_name”, to filter the desired module version. Especially when running globally with -g. For example: “npm list -g | grep express” to get the installed express version.

    – guya

    Apr 16, 2013 at 1:51

  • 111

    If you want a specific module, you can run it like npm list less-middleware as an example.

    – juanpaco

    Mar 16, 2014 at 19:43

  • 15

    Per @guya’s tip for *nix based systems, on Windows you can use PowerShell for similar results: | select-string module_name to filter the module. Or, if you’re using Git Bash (or just Bash, for that matter), you can use grep.

    – Noel

    Feb 12, 2016 at 20:33

  • 16

    If you can’t remember list, npm ls also works. In fact, many npm commands have aliases, and moreover, if you type a substring of a command, if this substring is unambiguous, it will work also; for instance npm ls, npm list, npm lis are all the same. If you want more verbose output, try npm ll (but probably you want --depth=0 added to it).

    – jakub.g

    May 16, 2016 at 18:35

  • 5

    The output isn’t the best for parsing with a script. Is there really not a way to get an output that is just the package version without having to do something like npm list -g | awk [email protected] '/<package>/ { print $2}'

    – Thayne

    Nov 7, 2017 at 19:09


Another quick way of finding out what packages are installed locally and without their dependencies is to use:

npm list --depth=0

Which gives you something like

├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

Obviously, the same can be done globally with npm list -g --depth=0.

This method is clearer if you have installed a lot of packages.

To find out which packages need to be updated, you can use npm outdated -g --depth=0.


  • 15

    it’s give me same as without the –depth

    – ygaradon

    Feb 27, 2014 at 18:07

  • 8

    it seems they’ve fixed it in npm 1.4.6. See

    – Howie

    Jun 8, 2014 at 8:28

  • 8

    Works great with | grep <package_name>

    Jul 1, 2015 at 14:14

  • 5

    @ygaradon Correct, but the --depth=0 makes it faster, because it does not have to recursively load dependencies

    Jul 1, 2015 at 15:17

  • npm list -g --depth=0 for list modules installed globally

    – EdgeDev

    Apr 9, 2019 at 22:51


npm view <package> version – returns the latest available version on the package.

npm list --depth=0 – returns versions of all installed modules without dependencies.

npm list – returns versions of all modules and dependencies.

And lastly to get node version: node -v


  • 24

    npm view <package> version, goes to the npm remote registry, not local filesystem…

    Dec 5, 2016 at 9:19

  • @AlexanderMills True, but having it here avoids another search for that. Btw, npm v, npm info and npm show are all alias of npm view.

    – CPHPython

    Jan 17, 2018 at 10:38

  • along the same lines, npm view <package> versions will return all the versions for the package and not just the latest one.

    – rgantla

    Jul 6, 2020 at 19:52