Node.js is updating quite frequently these days, so using your terminal on a Mac or command line on Windows would make update process faster.

Updating Node.js on a Mac

To update node.js on a mac, through terminal, you have a lot of options through popular package managers or node.js version managers.

N

N is a very simple node.js version management system. If you don’t have it, you can install it:

$ npm install -g n

To update to the latest node.js version, you can run the following command:

sudo n latest

Homebrew

Homebrew is a package manager for Mac. If you don’t have it, your can install it:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

If you haven’t installed node through brew you can do it using this command:

brew install node

To update to the latest node.js version, you can run the following command:

brew update
brew upgrade node

Nvm

Nvm is a script-based node version manager. If you don’t have it, your can install it:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh | bash

or with wget

wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh | bash

To update to the latest node.js version, you can run the following command:

nvm install node --reinstall-packages-from=node

Updating Node.js on Windows

For Windows, the options are not that many, but still you can do it through command line.

NVM for Windows

Nvm is a Node Version Manager for windows, that allows you to manage multiple installations of node.js on a Windows computer. If you don’t have it, you need to download an installer the first time.

After you have completed installation, you can update to the latest node.js version through the following command:

nvm install latest

nvm-install-latest-node.js

Categorized in:

Tagged in:

,