Course contentsShow
← JavaScript
Lesson 2492 of 2,72351. Package ManagementFree lesson

npm search and Finding Packages

Searching the NPM registry for packages directly from the command line.

npm search and Finding Packages

You'll learn how to discover NPM packages directly from your terminal without leaving your command line.

When you need to find a package but don't know its exact name, you don't have to open a browser and visit npmjs.com—NPM provides a built-in search command that queries the registry right from your terminal.

How npm search Works

The npm search command queries the NPM registry and returns matching packages based on your search term. Think of it like using a search engine, but specifically for JavaScript packages:

npm search react

This returns a table of packages with names, descriptions, authors, and other metadata that match "react".

Search Results Include Key Metadata

When you run a search, you'll see several columns:

  • NAME: The package name
  • DESCRIPTION: What the package does
  • AUTHOR: Who maintains it
  • DATE: Last publish date
  • VERSION: Current version
  • KEYWORDS: Tags associated with the package

This helps you evaluate packages without visiting external websites.

Refining Your Search

You can search for multiple words:

npm search form validation

NPM will return packages matching both terms or either term, ranked by relevance.

When to Use npm search

Use npm search when you:

  • Don't know the exact package name
  • Want to compare similar packages quickly
  • Prefer staying in the terminal
  • Need to see what's available in a specific domain (like "testing" or "parser")

For detailed package information (README, full documentation), you'll still want to visit the package page or use npm view <package-name>.

Key Takeaway: npm search <term> lets you discover packages from the command line, showing names, descriptions, and metadata without leaving your terminal.