Find the installed version of the npm package

How to find out the version of a specific package you have installed in the application

To view the latest version of all installed npm packages, including their dependencies, do the following:

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 openpackage-lock.jsonFiles, but this involves some visual scanning.

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

To get only the top-level packages (basically, the packages you told npm to install, and inpackage.json), runnpm 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 its name:

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

This also applies to the dependencies of the packages you install:

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

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

❯ npm view cowsay version

1.3.1

Download mine for freeNode.js manual


More node tutorials: