Latest Code Tutorials

How to Update Node Version In Mac In 2022

Right now, Node.js version 16.8.0 is the latest, and yours might be different depending on when you are reading this article. Web Development is changing rapidly. Development is picking at a rapid pace, and Node.js is shipping out the new version to almost everyone; therefore, it is nice to have the latest version at hand in your development environment to test out the new features and also made it compatible with other Javascript libraries.

Why you should upgrade the node

Well, you have many reasons that why you should update the node to the latest version because the Javascript community is getting bigger and bigger, and so does the NPM repository.

All the new JS frameworks and libraries require the latest node.js version because they are built on the latest technology, and to keep up with that. You also need to update all of your outdated libraries, especially Node.js.

Let me give you a scenario, and if you are using the current date’s latest version of React, which is React 16.2.0, and you have a node.js version of, let say 9.0, then you won’t be able to even install the React.js project due to some outdated libraries of node.js.

You do need to update to the latest version to even work with other JS libraries and frameworks.

Even node.js is improving from their previous version, so there are many reasons to upgrade your node.js to the latest version. Getting left behind will be the never option for yours.

How to Update Node Version on Mac

Okay, so we have seen why do we need to update Node.js, but the next question is how we are going to do it.

Well, three ways can do that job.

  1. Using N
  2. Using Homebrew
  3. Using NVM

Update Node using N

It is the simplest way.

N is an npm-based node version manager.

I am assuming that you already have some version of node is installed on your machine.

You can install it by installing the first version of the node and then running the following command.

sudo npm install -g n.

Assuming you have successfully installed n.

The following command will install the latest version of the node. Please hit that command in admin mode.

sudo n latest

It will install the latest version of Node.js.

Update Node.js using Homebrew

Homebrew is one of the popular package managers for MacOS.

Assuming you have previously installed node with.

You can get up-to-date with formulae and upgrade to the latest Node.js version with the following command.

brew update
brew upgrade node

It will install the latest version of Node.js.

Update Node using NVM

Nvm is the script-based node version manager.

You can install it easily with the curl and bash one-liner as described in the documentation.

It’s also available on the Homebrew package manager.

You can install NVM using Homebrew using the following command.

brew install nvm

Now the following command will install the latest version of the node.

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

The last option installs all the global npm packages over to your new version.

This way, the packages like mocha and node-inspector keep working.


Upgrading node to the latest version is kid’s stuff, but if you are running in trouble, you can always switch the way to update it.

If you are running in trouble using homebrew, please update the homebrew first and then install one by one missing dependency. It will work fine only after it has all the required dependencies.

Always if possible, keep your node.js version updated.

That’s it for today.

1 Comment
  1. Joe says

    Krunal, thanks for the post.

    When I run ‘sudo n latest’ I receive the following message:
    installed : v13.12.0 to /usr/local/bin/node
    active : v6.13.1 at /Users//miniconda3/bin/node

    How can I update the active Node?

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.