2019-11-05 14:55:08 -05:00
|
|
|
---
|
2019-11-18 21:01:39 +02:00
|
|
|
section: cli-commands
|
2019-11-05 14:55:08 -05:00
|
|
|
title: npm-search
|
|
|
|
description: Search for packages
|
|
|
|
---
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2019-11-18 21:01:39 +02:00
|
|
|
# npm-search(1)
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
## Search for packages
|
2015-10-09 23:13:57 -07:00
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
### Synopsis
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
```bash
|
|
|
|
npm search [-l|--long] [--json] [--parseable] [--no-description] [search terms ...]
|
|
|
|
|
|
|
|
aliases: s, se, find
|
|
|
|
```
|
|
|
|
|
|
|
|
### Description
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2016-12-18 20:22:09 -08:00
|
|
|
Search the registry for packages matching the search terms. `npm search`
|
|
|
|
performs a linear, incremental, lexically-ordered search through package
|
|
|
|
metadata for all files in the registry. If color is enabled, it will further
|
|
|
|
highlight the matches in the results.
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2016-12-18 20:22:09 -08:00
|
|
|
Additionally, using the `--searchopts` and `--searchexclude` options paired with
|
|
|
|
more search terms will respectively include and exclude further patterns. The
|
|
|
|
main difference between `--searchopts` and the standard search terms is that the
|
|
|
|
former does not highlight results in the output and can be used for more
|
|
|
|
fine-grained filtering. Additionally, both of these can be added to `.npmrc` for
|
|
|
|
default search filtering behavior.
|
|
|
|
|
|
|
|
Search also allows targeting of maintainers in search results, by prefixing
|
|
|
|
their npm username with `=`.
|
|
|
|
|
|
|
|
If a term starts with `/`, then it's interpreted as a regular expression and
|
|
|
|
supports standard JavaScript RegExp syntax. A trailing `/` will be ignored in
|
|
|
|
this case. (Note that many regular expression characters must be escaped or
|
|
|
|
quoted in most shells.)
|
|
|
|
|
|
|
|
### A Note on caching
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
### Configuration
|
2014-01-19 21:13:20 -08:00
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
#### description
|
2016-12-18 20:22:09 -08:00
|
|
|
|
|
|
|
* Default: true
|
|
|
|
* Type: Boolean
|
|
|
|
|
|
|
|
Used as `--no-description`, disables search matching in package descriptions and
|
|
|
|
suppresses display of that field in results.
|
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
#### json
|
2016-12-18 20:22:09 -08:00
|
|
|
|
|
|
|
* Default: false
|
|
|
|
* Type: Boolean
|
|
|
|
|
|
|
|
Output search results as a JSON array.
|
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
#### parseable
|
2016-12-18 20:22:09 -08:00
|
|
|
|
|
|
|
* Default: false
|
|
|
|
* Type: Boolean
|
|
|
|
|
|
|
|
Output search results as lines with tab-separated columns.
|
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
#### long
|
2014-01-19 21:13:20 -08:00
|
|
|
|
|
|
|
* Default: false
|
|
|
|
* Type: Boolean
|
|
|
|
|
|
|
|
Display full package descriptions and other long text across multiple
|
|
|
|
lines. When disabled (default) search results are truncated to fit
|
|
|
|
neatly on a single line. Modules with extremely long names will
|
|
|
|
fall on multiple lines.
|
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
#### searchopts
|
2016-12-18 20:22:09 -08:00
|
|
|
|
|
|
|
* Default: ""
|
|
|
|
* Type: String
|
|
|
|
|
|
|
|
Space-separated options that are always passed to search.
|
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
#### searchexclude
|
2016-12-18 20:22:09 -08:00
|
|
|
|
|
|
|
* Default: ""
|
|
|
|
* Type: String
|
|
|
|
|
|
|
|
Space-separated options that limit the results from search.
|
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
#### searchstaleness
|
2016-12-18 20:22:09 -08:00
|
|
|
|
|
|
|
* Default: 900 (15 minutes)
|
|
|
|
* Type: Number
|
|
|
|
|
|
|
|
The age of the cache, in seconds, before another registry request is made.
|
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
#### registry
|
2016-03-29 23:30:51 -07:00
|
|
|
|
|
|
|
* Default: https://registry.npmjs.org/
|
2016-12-18 20:22:09 -08:00
|
|
|
* Type: url
|
2016-03-29 23:30:51 -07:00
|
|
|
|
2016-12-18 20:22:09 -08:00
|
|
|
Search the specified registry for modules. If you have configured npm to point
|
|
|
|
to a different default registry, such as your internal private module
|
|
|
|
repository, `npm search` will default to that registry when searching. Pass a
|
|
|
|
different registry url such as the default above in order to override this
|
|
|
|
setting.
|
2016-03-29 23:30:51 -07:00
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
### See Also
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
* [npm registry](/using-npm/registry)
|
2020-10-02 17:52:19 -04:00
|
|
|
* [npm config](/cli-commands/config)
|
2019-11-05 14:55:08 -05:00
|
|
|
* [npmrc](/configuring-npm/npmrc)
|
2020-10-02 17:52:19 -04:00
|
|
|
* [npm view](/cli-commands/view)
|