isaacs/npm — Issue #1525: numeric password and trim
Author: kapouer
Created: 2011-10-10 07:59:11+00:00
State: open

I added a user with a digits-only password .
It got converted to an integer, somehow, so trim() doesn't exist.
Fix is obvious : (password || "").toString().trim()

info it worked if it ends with ok
verbose cli [ 'node', '/usr/bin/npm', 'adduser' ]
info using npm@1.0.94
info using node@v0.4.12
verbose config file /home/dev/.npmrc
verbose config file /usr/etc/npmrc
verbose config file /usr/share/npm/npmrc
ERR! TypeError: Object 123456 has no method 'trim'
ERR! at Object.adduser (/usr/share/npm/lib/utils/npm-registry-client/adduser.js:22:31)
ERR! at /usr/share/npm/lib/adduser.js:40:16
ERR! at go (/usr/share/npm/lib/utils/promise-chain.js:20:19)
ERR! at /usr/share/npm/lib/utils/promise-chain.js:33:13
ERR! at ReadStream.D (/usr/share/npm/lib/utils/prompt.js:38:7)
ERR! at ReadStream.emit (events.js:64:17)
ERR! at ReadStream._onReadable (net.js:667:31)
ERR! at IOWatcher.onReadable [as callback] (net.js:177:10)
ERR! Report this *entire* log at:
ERR!
ERR! or email it to:
ERR!
ERR!
ERR! System Linux 3.1.0-rc7
ERR! command "node" "/usr/bin/npm" "adduser"
ERR! cwd /home/dev
ERR! node -v v0.4.12
ERR! npm -v 1.0.94
ERR! type undefined_method
ERR! arguments [ 'trim', 123456 ]
verbose exit [ 1, true ]