How am I supposed to find out what is the latest s

2019-03-15 08:35发布

问题:

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

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

回答1:

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' }


回答2:

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 npm@1.2


标签: npm