如何查找已安装的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> versionHow 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.6npm 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.1Alternatively, 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更多推荐
发布评论