← 返回命令列表

Linux command

npm-view 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

View package info

npm view [package]

View a specific field

npm view [package] version

View all published versions

npm view [package] versions

View package dependencies

npm view [package] dependencies

View a nested field

npm view [package] repository.url

Output as JSON

npm view [package] --json

View dist-tags

npm view [package] dist-tags

View a specific version's info

npm view [package]@[2.0.0]

View info from a custom registry

npm view [package] --registry [https://registry.example.com]

说明

npm view fetches and displays metadata about a package from the npm registry. It shows the full package manifest by default, or specific fields when requested. The command supports nested field access with dot notation (e.g., `repository.url`). When a field contains an array, each element is printed on a separate line. Multiple fields can be specified to show several values at once. Aliases: npm info, npm show.

参数

versions
List all published versions.
dependencies
Show production dependencies.
dist-tags
Show distribution tags.
--json
Output in JSON format.
--registry _url_
Query a custom registry URL.

FAQ

What is the npm-view command used for?

npm view fetches and displays metadata about a package from the npm registry. It shows the full package manifest by default, or specific fields when requested. The command supports nested field access with dot notation (e.g., `repository.url`). When a field contains an array, each element is printed on a separate line. Multiple fields can be specified to show several values at once. Aliases: npm info, npm show.

How do I run a basic npm-view example?

Run `npm view [package]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does versions do in npm-view?

List all published versions.