LinuxCommandLibrary

npm-view

View package details from the npm registry

TLDR

View information about the latest version of a package

$ npm view [package]
copy

View information about a specific version of a package
$ npm view [package]@[version]
copy

View all available versions of a package
$ npm view [package] versions
copy

View the description of a package
$ npm view [package] description
copy

View the dependencies of the latest version of a package
$ npm view [package] dependencies
copy

View the repository URL of a package
$ npm view [package] repository
copy

View the maintainers of a package
$ npm view [package] maintainers
copy

SYNOPSIS

npm view <package-name>[@<version>] [<field>]

PARAMETERS

<package-name>
    The name of the package to inspect in the npm registry.

[@<version>]
    Optional. A specific version or version range of the package to view. If omitted, the latest version is used.

[<field>]
    Optional. A specific field or property to retrieve from the package's metadata. Uses dot notation to access nested properties (e.g., `dependencies`, `author.name`).

DESCRIPTION

The `npm view` command retrieves information about a specific package from the npm registry. It allows you to inspect various aspects of a package, such as its version, dependencies, author, repository, and more. This command is invaluable for developers seeking to understand package details without needing to download the entire package.

You can query specific fields, such as `npm view version`, or retrieve comprehensive information about the package by just providing the package name. This is also useful when inspecting the changes performed by a package between different versions. You can filter and format the output to suit your needs using dot notation to access nested properties. Also, it supports version specifiers to find the correct version of a package that matches your constraints. The command interacts directly with the npm registry to fetch data ensuring you always have the latest available information. This is helpful for verifying whether a package exists and what versions are available.

CAVEATS

Rate limiting by the npm registry may affect the usage of the command. If the registry is unavailable or unreachable, the command will fail.

EXAMPLES

  • Get the latest version of `lodash`: npm view lodash version
  • Get the dependencies of `react` version 16.8.0: npm view react@16.8.0 dependencies
  • Get the author's name of `express`: npm view express author.name

OUTPUT FORMAT

The output format depends on the field specified. If no field is specified, a detailed JSON representation of the package's metadata is returned. If a specific field is specified, the value of that field is returned.

SEE ALSO

npm(1), npm-registry(7), npm-install(1)

Copied to clipboard