How am I supposed to find out what is the latest stable version of an npm package?

前端 未结 2 814
面向向阳花
面向向阳花 2021-02-05 15:44

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

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

相关标签:
2条回答
  • 2021-02-05 16:13

    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
    
    0 讨论(0)
  • 2021-02-05 16:31

    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' }
    
    0 讨论(0)
提交回复
热议问题