2 March 2017

Update Node.js And Packages

Each time I go to use a Node.js package on my laptop I wonder how to upgrade Node.js and its packages. Homebrew would make it easier, so next I’ll wonder why I’m not using that. For now, though, here’s a way to upgrade Node.js and packages…

Get n, if it’s not already there

Thank you stackoverflow.com!

$ npm cache clean
$ npm install -g n

Upgrade Node.js

Note: Because of environment variable dependencies you may have to log out and log back in before ‘node -v’ will show you the upgraded version.

$ sudo n stable

Upgrade Node.js Packages

I’m using npm. Apparently there are alternatives?

$ npm --depth 9999 upgrade
$ npm --depth 9999 upgrade -g
comments? | contribute | tags: notes