npm-view
View package details from the npm registry
TLDR
View information about the latest version of a package
View information about a specific version of a package
View all available versions of a package
View the description of a package
View the dependencies of the latest version of a package
View the repository URL of a package
View the maintainers of a package
SYNOPSIS
npm view <package-spec> [<field>...] [--json] [--registry <url>] [--otp <code>]
PARAMETERS
<package-spec>
The name of the package to query. Can include a version or tag, e.g., react or lodash@4.17.21.
<field>...
One or more specific fields to display from the package metadata. This can be a top-level field like version, dependencies, license, or a nested field like repository.url. Special fields like versions (to list all versions) or dist-tags are also supported.
--json
Output the package metadata in JSON format. This is useful for programmatic parsing of the information.
--registry <url>
Specify a custom npm registry URL to fetch package information from, overriding the default configured registry.
--otp <code>
Provide a one-time password for authenticated requests, typically when accessing private packages or performing operations that require user verification.
--color
Control color output in the terminal. Set to false to disable color (e.g., --no-color).
DESCRIPTION
The npm view command (also aliased as npm info) fetches and displays detailed metadata about a specified package from the npm registry.
It's commonly used by developers to quickly access information such as available versions, dependencies, license, author, and other descriptive fields for a package without installing it. You can query for the latest version's information, a specific version, or even a particular field within a package's metadata. This command is invaluable for understanding package details, debugging dependency issues, or simply exploring the npm ecosystem.
CAVEATS
npm view relies on network access to the npm registry. Without connectivity, it cannot retrieve package information. For private packages, appropriate authentication (like login credentials or OTP) may be required. The specific fields available can vary between packages.
COMMON USAGE PATTERNS
- npm view
: Displays general information about the latest version of a package. - npm view
versions : Lists all published versions of a package. - npm view
homepage : Shows the homepage URL specified in the package.json. - npm view
repository.url : Retrieves the repository URL. - npm view
--json : Gets all available metadata for a package in JSON format.
DATA SOURCE
Information is fetched directly from the npm registry (or a configured private registry), not from your local node_modules directory. This ensures you're always viewing the most up-to-date published information.
HISTORY
The npm view command has been a fundamental part of the npm CLI since its early versions, providing a core utility for inspecting package details. It is an alias to npm info, which also performs the same function. Its consistent presence highlights its importance in the npm ecosystem for both developers and automated tooling to gather package metadata.
SEE ALSO
npm(1), npm-install(1), npm-search(1), npm-show(1)