LinuxCommandLibrary

npm-search

Search for packages on the npm registry

TLDR

Search for a package by name

$ npm search [package]
copy

Search for packages by a specific keyword
$ npm search [keyword]
copy

Search for packages, including detailed information (e.g., description, author, version)
$ npm search [package] --long
copy

Search for packages maintained by a specific author
$ npm search --author [author]
copy

Search for packages with a specific organization
$ npm search --scope [organization]
copy

Search for packages with a specific combination of terms
$ npm search [term1 term2 ...]
copy

SYNOPSIS

npm search [options] <search terms>

PARAMETERS

<search terms>
    The text to search for within the npm registry.

-l, --long
    Show extended information.

--json
    Output results as a JSON array.

--parseable
    Output parseable results, using \t as a field separator, and \n for records.

--no-description
    Do not show the description.

--staleness <days>
    How long is the cache considered fresh.

--offline
    Force offline mode: no network requests will be made.

--cidr <cidr_block>
    Classless Inter-Domain Routing.

--loglevel <level>
    What level of logs to report.

--usage
    Display usage info.

DESCRIPTION

The `npm-search` command is a command-line utility that allows users to search the npm registry for packages.

It provides a way to quickly find npm packages based on keywords, author names, or other search terms directly from the terminal. This eliminates the need to open a web browser and navigate to the npm website for simple searches.

The tool typically returns a list of packages that match the search criteria, along with basic information about each package, such as its name, version, and a brief description. It helps developers quickly discover and explore packages available on npm, making it easier to find and incorporate dependencies into their projects. The search functionality uses the npm registry's search API to fetch results.

CAVEATS

The `npm search` command's output format and behavior can vary slightly depending on the npm version. The `npm search` command is scheduled to be removed, and users are recommended to use `npm explore`.

OUTPUT INTERPRETATION

The basic output of `npm search` typically includes the package name, version, author, and a short description. The `--long` option provides more detailed information. Using the option --json will output a json object which has all meta information.

HISTORY

The `npm search` command has been part of the npm CLI for a long time, providing a simple way to find packages. It has evolved over time to include features like JSON output and filtering.

However, due to performance issues and the availability of more advanced search tools and APIs, `npm search` is scheduled for removal. `npm explore` will be a replacement.

SEE ALSO

npm(1), npm-explore(1), npm-install(1)

Copied to clipboard