Upgrade Node.js via NPM

I saw that my node.js was outdated and wanted to update it. I thought it would be as simple as this:

$ node upgrade

Nope. Instead I got this crazy error.

throw err;
Error: Cannot find module '/Users/philiphowley/Dropbox/meteor-stuff/chris_event_tutorial/upgrade'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3

This link on David Walsh’s blog was the solution I needed and it was super simple:

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

then just check your node version and you have now updated your node.js. Thanks David!

Leave a Reply

Your email address will not be published. Required fields are marked *