AppDividend
Latest Code Tutorials

How To Update Node Version In Mac In 2020

1

In this tutorial, we will see How To Update Node Version In Mac In 2020. Right now, Node.js version 13.3 is the latest, and yours might be different depending on when you are reading this article. Web Development is changing rapidly. Development is picking a rapid pace, and Node.js is shipping out the new version almost every week. It is nice to have the latest version at hand in your development environment to test out the new features and also made compatible with other Javascript libraries.

Why you should upgrade node

Well, you have many reasons that why you should update node to 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, and 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 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 lots of 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 have already 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 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.

Conclusions

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

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

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

Finally, How To Update Node Version In Mac In 2020 Tutorial is over.

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.