Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

n module breaks npm

After I switch from one node.js version to another with n module - https://github.com/visionmedia/n/, my npm is broken...

MacBook-Pro-Dmitri:~ dmitri$ npm --version

module.js:340
    throw err;
          ^
Error: Cannot find module 'npmlog'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at /usr/local/bin/npm:19:11
    at Object.<anonymous> (/usr/local/bin/npm:87:3)
    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)

then i'm installing npm again as it was adviced here - https://github.com/visionmedia/n/issues/101

curl https://npmjs.org/install.sh | sh

npm begins to work..

but then i do another switch for node version:

n 0.8.22

and npm now is broken again with the same error.

it's very annoying.. do I need to install npm manually after every version switch?!

like image 928
Kosmetika Avatar asked May 29 '13 08:05

Kosmetika


1 Answers

Are there different global package repositories for different versions?

Perhaps either that package needs to be re-installed globally sudo npm install -g or the package manage cache cleaned sudo npm cache clean after switching version(s).

like image 125
Charney Kaye Avatar answered Oct 20 '22 00:10

Charney Kaye