In this short tutorial you’ll learn how to check the version of any installed npm package including the ones that have been installed globally using the -g flag.

Locally installed packages

To check the current versions of the npm packages for your project, you should navigate to the project directory where your package.json is located and run the command npm list.

npm list

Here’s the structure of the output:

├── canvas@2.6.1
└── words-array@1.0.1

Global npm packages

To check the current version of the packages you’ve installed globally, you should add the -g flag.

npm list -g
├── firebase-tools@9.16.0
├── jest@28.1.1
├── nodemon@2.0.15
├── npm@7.18.1
├── pnpm@7.6.0
├── rimraf@3.0.2
└── vsce@2.7.0