Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Errors running npm 1.1.49 and 1.1.59 #2751

Closed
bog opened this Issue · 4 comments

3 participants

@bog

I'm running into errors running npm bundled with node ≥ 0.8.7 (1.1.49 +) on OS X 10.8. I manage my node installs locally with nvm.

Here is the error (happens if i just run npm by itself as well):

jalavaadita:~ bog$ npm install request
Error: First argument needs to be a number, array or string.
    at new Buffer (buffer.js:236:15)
    at Conf.add (/Users/bog/.nvm/v0.8.8/lib/node_modules/npm/node_modules/npmconf/npmconf.js:250:16)
    at ConfigChain.addString (/Users/bog/.nvm/v0.8.8/lib/node_modules/npm/node_modules/npmconf/node_modules/config-chain/index.js:244:8)
    at Conf.addFile (/Users/bog/.nvm/v0.8.8/lib/node_modules/npm/node_modules/npmconf/npmconf.js:235:10)
    at fs.readFile (fs.js:176:14)
    at fs.close (/Users/bog/.nvm/v0.8.8/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:92:5)
    at Object.oncomplete (fs.js:297:15)


/Users/bog/.nvm/v0.8.8/lib/node_modules/npm/lib/utils/error-handler.js:49
  var doExit = npm.config.get("_exit")
                          ^
TypeError: Object #<Object> has no method 'get'
    at exit (/Users/bog/.nvm/v0.8.8/lib/node_modules/npm/lib/utils/error-handler.js:49:27)
    at process.errorHandler (/Users/bog/.nvm/v0.8.8/lib/node_modules/npm/lib/utils/error-handler.js:264:3)
    at process.EventEmitter.emit (events.js:115:20)

npm 1.1.48 (bundled with node v0.8.6) works without issue.

@isaacs
Owner

Does it work when you're not using nvm?

@bog

Same issue. Errors now originate from files in /usr/local/lib/node_modules/npm/ so it's definitely the manually installed reference.

@bog

So, I investigated this a bit further. It's definitely an issue with npmconf (I can move the ticket if you want, but since it's already started…)

The contents of my .npmrc file are:

_password = undefined
_authCrypt = undefined
_auth = undefined

It's definitely an old file. It looks like Conf.add is creating a buffer for auth from that file. Since auth is undefined, the crash ensues. I'm not sure of the history here so I don't feel comfortable submitting a patch that just checks for undefined, but that does fix the issue locally (as does authenticating or removing the .npmrc file).

@domenic
Collaborator

Not sure what went wrong here, but hopefully a clean install fixed it. Let us know if you're still having this problem.

@domenic domenic closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.