Skip to content
Software capabilities
npm

Inspect metadata for a version of an npm package

Use npm view to inspect one package version without installing it. Use the registry response when comparing metadata across versions or building a package lookup.

Documentation reviewed · 2 methods with sources

Ways to do it

  1. CLI: npm view <package>@<version> <field>
  2. API: GET /{package}
CLI

npm view <package>@<version> <field>

Query version-specific fields such as dependencies, engines, or dist.tarball.

Read source: npm view command reference
Requirements
The npm CLI, the package name and version, and access to the configured registry.
Limitations
Leaving out the version selects the latest distribution tag. Add --json when another program needs to read the result.

Example shell

npm view is-number@7.0.0 engines --json
API

GET /{package}

Fetch the full registry package document and select versions[version] for the release you need.

Read source: npm registry package metadata format
Requirements
A package name and access to the npm registry. Public packages can be read without a token.
Limitations
The abbreviated install representation omits some metadata. Request the full JSON response when you need complete version records.

Example shell

curl --fail -H 'Accept: application/json' https://registry.npmjs.org/is-number