I would like to search for, e.g. 'carousel' and exclude results with 'react' in them. I have tried:
carousel -react
and
carousel NOT react
But this still turns up results with 'react' in them. How can I exclude search terms on npm?
I would like to search for, e.g. 'carousel' and exclude results with 'react' in them. I have tried:
carousel -react
and
carousel NOT react
But this still turns up results with 'react' in them. How can I exclude search terms on npm?
How can I exclude search terms on npm?
If you are asking about NPM search in the shell I think the only way to exclude words is by using a search regex Here is an excerpt from the NPM Search documentation:
If a term starts with /, then it's interpreted as a regular expression. A trailing / will be ignored in this case. (Note that many regular expression characters must be escaped or quoted in most shells.)
A very simple example of regex search is:
npm search /carousel/
Implementing the actual regex to exclude react is outside the scope of this question and it would involve creating a negative lookahead/lookbehind regex expression.
I don't know if you want to do it specificly using npm, but you can also pipe it with grep:
npm search carousel | grep -v -i react
I gave up on grep and used google:
site:www.npmjs.com react camera -native
Try this:
keywords:carousel,-react
https://www.npmjs.com/search?q=keywords%3Acarousel%2C-react
The downside is that it looks for the keywords aka. tags, so it requires that the authors have added carousel as a tag.
You can potentially expand your search a bit to all packages with "carousel" anywhere in their text, but which has not got a react keyword/tag:
carousel keywords:-react
https://www.npmjs.com/search?q=carousel%20keywords%3A-react
For more search commands, see: