Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NPM error on any command

Tags:

node.js

npm

macos

I downloaded the latest version of Node.js (0.8.8) and it works all fine and dandy, but the NPM that is packaged with the Node.js installation is now failing. It worked when I had an outdated version of Node.js (0.5.x) and I could type commands like

npm --version

and It would return the current version of NPM. However when I do any command (even the one above) I receieve this error

$ npm -v

/usr/lib/node_modules/npm/lib/utils/config-defs.js:5
  , stdio = process.binding("stdio")
                ^
Error: No such module
  at Object.<anonymous> (/usr/lib/node_modules/npm/lib/utils/config-defs.js:5:21)
  at Module._compile (module.js:449:26)
  at Object.Module._extensions..js (module.js:467:10)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:362:17)
  at require (module.js:378:17)
  at Object.<anonymous> (/usr/lib/node_modules/npm/lib/utils/ini.js:43:18)
  at Module._compile (module.js:449:26)
  at Object.Module._extensions..js (module.js:467:10)

I am using NPM version 1.1.59

Note: I have tried updating NPM with

$ curl -L curl http://npmjs.org/install.sh | sudo sh

But that didn't work either.

like image 726
fnky Avatar asked Sep 01 '12 20:09

fnky


1 Answers

Thanks to Sean's comment on an answer at his own post, I got it. After I removed the npm module from

/usr/lib/node_modules/

and the binary from

/usr/bin/

It's all now working.

I think after installing the latest Node.js it might have conflicted, because both paths were global. Hope this helps anyone in the future :-)

like image 77
fnky Avatar answered Oct 19 '22 01:10

fnky