In general npm search behaves strange, it takes a very long time, and it varies in order and time, from time to time.
The first time I wrote
$ npm search jquery
it took more than two minutes. Subsequent searches have taken around 30 seconds. Sometimes I get the matches before the http request, sometimes the other way around:
Matching results first
$ npm search jquery.appendgrid
NAME DESCRIPTION AUTHOR DATE VERSION KEYWORDS
jquery.appendgrid appendGrid - The dynamic table input jQuery plugin =hkalbertl 2014-12-21 08:09 1.5.1 jquery-plugin ui header-detail master-d
npm http GET https://registry.npmjs.org/-/all/since?stale=update_after&startkey=1419625615355
npm http 200 https://registry.npmjs.org/-/all/since?stale=update_after&startkey=1419625615355
Matching results last
$ npm search jquery.appendgrid
npm http GET https://registry.npmjs.org/-/all/since?stale=update_after&startkey=1419625643062
npm http 200 https://registry.npmjs.org/-/all/since?stale=update_after&startkey=1419625643062
NAME DESCRIPTION AUTHOR DATE VERSION KEYWORDS
jquery.appendgrid appendGrid - The dynamic table input jQuery plugin =hkalbertl 2014-12-21 08:09 1.5.1 jquery-plugin ui header-detail master-d
In either case it takes around thirty seconds. Since it takes less than the initial two minutes I guess something has been cached, but it still makes a http request, and it still takes surprisingly long. It's not the time between the first http line and the second, that only takes 1-2 seconds. But there is a lot of waiting time both before and after.
What is going on, and can I speed it up?
If you find that npm is running slow and it isn't your computer or internet, it is most likely because of a severely outdated version.
it takes ~5 minutes to download and install.
It seems like npm do not deal well with internet connections and can sometimes end in such situation. 1) I'll advice you to check if your firewall or antivirus is not performing any scan or filtering which may slow down npm install. 2) You may also use caching from npm like below.
A year ago, when that tutorial was written, npm
had fewer published packages. Currently there are over 100,000. In order to do a npm search
, npm
downloads a JSON file describing all of the packages, crudely indexes it, and then searches over all the package descriptions.
The result is that npm search
as a local command is essentially broken right now -- it completes, but very slowly, and it creates an alarmingly large file to do so (60MB).
The suggested workaround for now is to use the online search tool at https://www.npmjs.com/
The npm repo should NOT be slow. Some people are saying here that it has over 100.000 packages... It actually has more than 165.000 but even this number is really small for any database. I believe they use CouchDB, which is very fast. In any case, if you don't get the results that you want you can always use other alternative search sites like:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With