14

How can I find the latest stable version of an npm package?

Other than going to http://search.npmjs.org and searching for it?

I usually need the version to put it in my package.json.

2 Answers 2

19

Use npm view [package-name] dist-tags in the command line.

Example:

$ npm view express dist-tags

{ latest: '2.5.9',
  '3.0': '3.0.0beta2' }
11

Since I had to google it myself:

After finding the specific version you want, install it using npm install -g [package-name]@[your-version]

Example:

$ npm view npm dist-tags

{ latest: '1.4.20',
  '1.4': '1.4.6',
  '1.2': '1.2.8000',
  'v1.5rc': '1.5.0-alpha-1' }

$  npm install -g [email protected]
2
  • 2
    the question originally was how to find out the version, not how to install it
    – PKlumpp
    Commented Jul 10, 2014 at 9:05
  • 4
    @ZerO correct, but I thought it might be helpful to some as it is a natural path after listing dist versions
    – Tmarty
    Commented Jul 10, 2014 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.