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

前端 未结 2 820
面向向阳花
面向向阳花 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
    

提交回复
热议问题