mixu/npm_lazy

Support 'npm search' - currently not implemented

sishbi opened this issue · 2 comments

I am trying to use npm_lazy as a proxy to the npmjs.org registry, I have configured and started npm_lazy on a local server and have configured the client to point to the npm_lazy server via the registry configuration.
Unfortunately npm_lazy does not support the 'npm search' command, this is a shame as it means that I have to remember to override registry + proxy whenever I want to use the 'npm search' command and it also means that I cannot publish the url as a general replacement for registry.npmjs.org in my organization.

Here is what I get:
I issued the 'npm search' command on the client:
"npm search yoeman-generator"

Which results in the following output in the client:

npm http GET http://sdc-team.uk.oracle.com:8080/-/all/since?stale=update_after&startkey=1390207602645
npm http 200 http://sdc-team.uk.oracle.com:8080/-/all/since?stale=update_after&startkey=1390207602645
npm ERR! TypeError: Cannot read property '_updated' of undefined
npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:85:26
npm ERR!     at cb (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:27:9)
npm ERR!     at RegClient.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:122:16)
npm ERR!     at cb (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:158:9)
npm ERR!     at RegClient.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:306:12)
npm ERR!     at Request.self.callback (/usr/local/lib/node_modules/npm/node_modules/request/request.js:123:22)
npm ERR!     at Request.EventEmitter.emit (events.js:98:17)
npm ERR!     at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:893:14)
npm ERR!     at Request.EventEmitter.emit (events.js:117:20)
npm ERR!     at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:844:12)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/isaacs/npm/issues>

npm ERR! System Darwin 13.0.0
npm ERR! command "node" "/usr/local/bin/npm" "search" "yoeman-generator"
npm ERR! cwd /Users/sbilling/IDEA/webapp
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.21
npm ERR! type non_object_property_load
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/sbilling/IDEA/webapp/npm-debug.log
npm ERR! not ok code 0

In the npm_lazy log file all I see is the following line:

Not implemented /-/all/since?stale=update_after&startkey=1390207602645

Looking at the code in api.js there is the following statement:

// /-/ or /package/-/ are special
api.get(new RegExp('^/-/(.+)$'), notImplemented);
api.get(new RegExp('^/(.+)/-(.*)$'), notImplemented);

As linked to above, this issue seems to have been fixed by commit lgtml@6e90a82

mixu commented

interesting, I wonder who's commit that is and why they didn't file a PR. anyway, I'll do a slightly more generic variant of this since it's a nice feature to have