Skip to content

[BUG] npm search with scope parameter does not return accurate results #8274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
abhijeetsharma7 opened this issue May 6, 2025 · 2 comments
Closed
2 tasks done
Labels
Bug thing that needs fixing Needs Triage needs review for next steps

Comments

@abhijeetsharma7
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

I am trying to get all the packages which starts with a specific scope, where scope is @.
The command i am using to get the same is -
npm search scope:@ --searchlimit=100 --json
However this yields not so good results. Many packages are return which are not related to the scope.

Also, is there a config for searchlimit like searchlimit=-1 which may return all the results instead of specifying a pre defined limit ?

Expected Behavior

Should return results of packages which contains the scope as mentioned in command.

Steps To Reproduce

No response

Environment

  • npm: 10.9.2
  • Node.js: 22.14.0
  • OS Name: mac
  • System Model Name: M3
  • npm config:
; copy and paste output from `npm config ls` here
@abhijeetsharma7 abhijeetsharma7 added Bug thing that needs fixing Needs Triage needs review for next steps labels May 6, 2025
@milaninfy
Copy link
Contributor

@abhijeetsharma7 Thank you for the report. This is currently working as expected.

Checkout the documentation https://docs.npmjs.com/cli/v11/commands/npm-search#description and https://docs.npmjs.com/cli/v11/commands/npm-search#searchopts .

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 your terminal has color support, it will further highlight the matches in the results

@abhijeetsharma7
Copy link
Author

@milaninfy thank you for your response.
I had a few doubts -

  1. Does searchopts always search for a scope or same needs to be mentioned. e.g. - npm search searchopts=scope:@someScope
  2. About searchlimit, i understand this the flag to specify a limit, but if i want all results is there any support for same like seachlimit=-1 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps
Projects
None yet
Development

No branches or pull requests

2 participants