npm - how to show the latest version of a package

前端 未结 6 1428
太阳男子
太阳男子 2020-12-04 05:46

How do I use npm to show the latest version of a module? I am expecting something like npm --latest express to print out v3.0.0.

6条回答
  •  星月不相逢
    2020-12-04 06:04

    You can see all the version of a module with npm view. eg: To list all versions of bootstrap including beta.

    npm view bootstrap versions
    

    But if the version list is very big it will truncate. An --json option will print all version including beta versions as well.

    npm view bootstrap versions --json
    

    If you want to list only the stable versions not the beta then use singular version

    npm view bootstrap@* versions
    

    Or

    npm view bootstrap@* versions --json
    

    And, if you want to see only latest version then here you go.

    npm view bootstrap version
    

提交回复
热议问题