How to update Node.Js on Mac, Linux or Windows
Updating Node.js may seem like a trivial task but I do it so infrequently I always forget about my "way" of doing it.
Version
Node has two different streams of versions to select from. The bleeding edge with the latest features and a stable LTS
release. If you don't know LTS
means Long-term Support. LTS
generally gives a predictable release schedule and a slower influx of extensive changes.
Now you may want to jump to the latest version, but I always recommend sticking with stable. You may want to play around with new features but if you ever plan on using your code in production it is best to get used to stable.
If you are interested in thee Node
LTS schedule, it is available on github.
Mac, Linux say hello to n
Node does not have a self updator built in. However, there is a wonderful package on npm
called n. This package makes updating to the latest version a piece of cake.
sudo npm install -g n
sudo n stable
Alternatively, if you dare, you can use sudo n latest
to get the latest release.
Windows
There is no spoon.
That's right, for some reason that eludes my research Windows does not have a command line installer to update Node
.
Head over to nodejs.org and download the installer for the current LTS release. Just follow the wizard and you are all set.