Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

(如何找到已安装的node.js / npm 软件包的版本?)

This prints the version of npm itself:

(这将打印npm本身的版本:)

npm -v <package-name>

This prints a cryptic error:

(这将显示一个神秘的错误:)

npm version <package-name>

This prints the package version on the registry (ie the latest version available):

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

npm view <package-name> version

How do I get the installed version ?

(如何获得安装的版本 ?)

  ask by Laurent Couvidou translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
491 views
Welcome To Ask or Share your Answers For Others

1 Answer

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

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

You can find the version of a specific package by passing its name as an argument.

(您可以通过传递特定软件包的名称作为参数来查找其版本。)

For example, npm list grunt will result in:

(例如, npm list grunt将导致:)

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:

(另外,您可以只运行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 

You can also add --depth = 0 to list installed packages without their dependencies.

(您也可以添加--depth = 0以列出已安装的软件包,而无需依赖它们。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...