Npm View

Summary: in this tutorial, you will learn how to use the npm view command to show data about a package.

To view information about a package, you typically go to the npmjs.com website, find the package name, and display its information.

The npm CLI tool provides the npm view command that allows you to quickly show the information on a package on the terminal.

Introduction to npm view Command #

The npm view command returns the information on a package:

npm view <package_name>[@<version>] [<field>?][<.subfield>]

The npm view command has the following aliases npm info, npm show, and npm v.

For example, to show the information about the express package, you use the following command:

npm view express

By default, the npm view command returns the latest version of the package if you don’t specify it in the package name.

To show the information of the express package version 4.17.1, you use this command:

npm view [email protected]

To show specific information on a package, you specify that information after the package name in the form of a field name. For example, the following command shows only dependencies of the express package:

npm view express dependencies

You can view the subfield of a field using the format field.subfield. For example, to view the repository URL of the express package, you use the following command:

npm view express repository.url

The following command shows the contributor emails of the express package:

npm view express contributors.email

To format the output in JSON, you use the --json flag. For example:

npm view express contributors --json

Summary #

  • Use the npm view command to show information on a package.

Was this helpful?