isaacs/npm — Issue #1662: unable to to 'search' - misinterpretation of module 'error'?
Author: hgoebl
Created: 2011-11-06 12:22:34+00:00
State: open

info it worked if it ends with ok
verbose cli [ 'node',
verbose cli '/home/heinrich/opt/node/bin/npm',
verbose cli 'search',
verbose cli 'express' ]
info using npm@1.0.30
info using node@v0.4.12
verbose config file /home/heinrich/.npmrc
verbose config file /home/heinrich/opt/node/etc/npmrc
verbose GET /-/all/since?stale=update_after&startkey=1317486182000
verbose raw, before any munging /-/all/since?stale=update_after&startkey=1317486182000
verbose url resolving [ 'https://registry.npmjs.org/',
verbose url resolving './-/all/since?stale=update_after&startkey=1317486182000' ]
verbose url resolved https://registry.npmjs.org/-/all/since?stale=update_after&startkey=1317486182000
ERR! Error: [object Object] : -/all/since
ERR! at Request.callback (/home/heinrich/opt/node/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:179:12)
ERR! at Request. (/home/heinrich/opt/node/lib/node_modules/npm/node_modules/request/main.js:337:18)
ERR! at Request.emit (events.js:64:17)
ERR! at IncomingMessage. (/home/heinrich/opt/node/lib/node_modules/npm/node_modules/request/main.js:305:16)
ERR! at IncomingMessage.emit (events.js:81:20)
ERR! at HTTPParser.onMessageComplete (http.js:133:23)
ERR! at CleartextStream.ondata (http.js:1231:22)
ERR! at CleartextStream._push (tls.js:303:27)
ERR! at SecurePair.cycle (tls.js:577:20)
ERR! at EncryptedStream.write (tls.js:96:13)
ERR! Report this *entire* log at:
ERR!
ERR! or email it to:
ERR!
ERR!

A problem could be that there is a module called "error" (git://github.com/Raynos/error.git).
In npm/lib/utils/npm-registry-client/request.js, method requestDone, error is checked by getting the property 'error'.
Here it gets the module 'error', which is not really an error but treated like this.

if (parsed && parsed.error) {
var w = url.parse(where).pathname.substr(1)
if (parsed.error === "not_found") {
w = w.split("/")
name = w[w.indexOf("_rewrite") + 1]
er = new Error("404 Not Found: "+name)
er.errno = npm.E404
er.pkgid = name
} else {
er = new Error(
parsed.error + " " + (parsed.reason || "") + ": " + w)
}