Skip to content

Find the installed version of an npm package

New Course Coming Soon:

Get Really Good at Git

How to find out which version of a particular package you have installed in your app

To see the latest version of all the npm package installed, including their dependencies:

npm list

Example:

❯ npm list
/Users/flavio/dev/node/cowsay
└─┬ [email protected]
  ├── [email protected]
  ├─┬ [email protected]
  │ ├── [email protected]
  │ └── [email protected]
  ├─┬ [email protected]
  │ ├── [email protected]
  │ └─┬ [email protected]
  │   └── [email protected]
  └── [email protected]

You can also just open the package-lock.json file, but this involves some visual scanning.

npm list -g is the same, but for globally installed packages.

To get only your top-level packages (basically, the ones you told npm to install and you listed in the package.json), run npm list --depth=0:

❯ npm list --depth=0
/Users/flavio/dev/node/cowsay
└── [email protected]

You can get the version of a specific package by specifying the name:

❯ npm list cowsay
/Users/flavio/dev/node/cowsay
└── [email protected]

This also works for dependencies of packages you installed:

❯ npm list minimist
/Users/flavio/dev/node/cowsay
└─┬ [email protected]
  └─┬ [email protected]
    └── [email protected]

If you want to see what’s the latest available version of the package on the npm repository, run npm view [package_name] version:

❯ npm view cowsay version

1.3.1
Are you intimidated by Git? Can’t figure out merge vs rebase? Are you afraid of screwing up something any time you have to do something in Git? Do you rely on ChatGPT or random people’s answer on StackOverflow to fix your problems? Your coworkers are tired of explaining Git to you all the time? Git is something we all need to use, but few of us really master it. I created this course to improve your Git (and GitHub) knowledge at a radical level. A course that helps you feel less frustrated with Git. Launching Summer 2024. Join the waiting list!
→ Get my Node.js Handbook
→ Read my Node.js Tutorial on The Valley of Code

Here is how can I help you: