404 code break npm-name behavior
Closed this issue · 5 comments
ghoullier commented
Reproduced with node v0.10.35 and v0.12.2
➜ ~ npm i -g npm-name
/usr/local/bin/npm-name -> /usr/local/lib/node_modules/npm-name/cli.js
npm-name@1.0.4 /usr/local/lib/node_modules/npm-name
├── registry-url@3.0.3 (rc@1.0.1)
├── log-symbols@1.0.2 (chalk@1.0.0)
└── got@2.8.0 (lowercase-keys@1.0.0, is-stream@1.0.1, object-assign@2.0.0, timed-out@2.0.0, prepend-http@1.0.1, nested-error-stacks@1.0.0, statuses@1.2.1, infinity-agent@2.0.3, read-all-stream@2.1.2, duplexify@3.3.0)
➜ ~ npm-name aaabbbccc
events.js:72
throw er; // Unhandled 'error' event
^
GotError: https://registry.npmjs.org/aaabbbccc response code is 404 (Not Found)
at /usr/local/lib/node_modules/npm-name/node_modules/got/index.js:120:12
at BufferStream.<anonymous> (/usr/local/lib/node_modules/npm-name/node_modules/got/node_modules/read-all-stream/index.js:52:3)
at BufferStream.emit (events.js:117:20)
at finishMaybe (/usr/local/lib/node_modules/npm-name/node_modules/got/node_modules/read-all-stream/node_modules/readable-stream/lib/_stream_writable.js:460:14)
at endWritable (/usr/local/lib/node_modules/npm-name/node_modules/got/node_modules/read-all-stream/node_modules/readable-stream/lib/_stream_writable.js:469:3)
at BufferStream.Writable.end (/usr/local/lib/node_modules/npm-name/node_modules/got/node_modules/read-all-stream/node_modules/readable-stream/lib/_stream_writable.js:436:5)
at IncomingMessage.onend (_stream_readable.js:502:10)
at IncomingMessage.g (events.js:180:16)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:944:16
ghoullier commented
I've got the same issue using js API
var npmName = require('npm-name');
var name = 'aaabbbccc';
npmName(name, function onGetNpmName(err, available) {
console.log('err', err);
console.log('available', available);
});
ghoullier commented
I've encounter the problem with yeoman generator-generator which check generator name and throw unhandled error
floatdrop commented
@sindresorhus this is a bug - cli returns 1
, but should return 0
without printing an error. Downgrading to got@2.7.2
is fixing it - investigating.
floatdrop commented
@ghoullier please update dependencies - now all should be fine.
ghoullier commented
It works now, thanks!! :-)