查找已安装的npm软件包的版本(Find the version of an installed npm package)

编程入门 行业动态 更新时间:2024-10-28 17:22:21
查找已安装的npm软件包的版本(Find the version of an installed npm package)

如何查找已安装的node.js / npm 的版本?

这会打印npm本身的版本:

npm -v <package-name>

这会打印一个隐秘的错误:

npm version <package-name>

这将打印注册表上的包版本(即可用的最新版本):

npm view <package-name> version

如何获取已安装的版本

How to find the version of an installed node.js/npm package?

This prints the version of npm itself:

npm -v <package-name>

This prints a cryptic error:

npm version <package-name>

This prints the package version on the registry (i.e. the latest version available):

npm view <package-name> version

How do I get the installed version?

最满意答案

用于本地软件包的npm list -g或全局安装软件包的npm list -g 。

通过传递其名称作为参数,可以找到特定包的版本。 例如, npm list grunt将导致:

projectName@projectVersion /path/to/project/folder └── grunt@0.4.1

或者,您只需运行npm list而不传递包名称作为参数,以查看所有包的版本:

├─┬ cli-color@0.1.6 │ └── es5-ext@0.7.1 ├── coffee-script@1.3.3 ├── less@1.3.0 ├─┬ sentry@0.1.2 │ ├── file@0.2.1 │ └── underscore@1.3.3 └── uglify-js@1.2.6

npm list for local packages or npm list -g for globally installed packages.

You can find the version of a specific package by passing its name as an argument. For example, npm list grunt will result in:

projectName@projectVersion /path/to/project/folder └── grunt@0.4.1

Alternatively, you can just run npm list without passing a package name as an argument to see the versions of all your packages:

├─┬ cli-color@0.1.6 │ └── es5-ext@0.7.1 ├── coffee-script@1.3.3 ├── less@1.3.0 ├─┬ sentry@0.1.2 │ ├── file@0.2.1 │ └── underscore@1.3.3 └── uglify-js@1.2.6

更多推荐

本文发布于:2023-08-06 05:07:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1444035.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:软件包   版本   npm   Find   package

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!