4
129

How to Update Nodejs to the latest on Mac OS

Reading Time: < 1 minute

Here, lets explore how we can update/upgrade nodejs to the latest version on mac OS.

Reasons for Update

There are various reasons that your system needs a

  • Improved Performance
  • Improved Features
  • New supported APIs

However, it will be good to refer to the list of breaking changes before updating so that you can update your running resources without failing them.

Methods

  1. Using N package
  2. Using Brew package manager

Update Nodejs using N package

It will be recommend to use this method if you have initially installed nodejs via the original website.

1st step: Check version of your existing nodejs installation

node -v

2nd step: Clean npm cache and verify

sudo npm cache clean --force
sudo npm cache verify

3rd step: Install N package

sudo npm install -g n

4th step: Update Node to latest

For LTS version, we will use the below command

sudo n lts

For current version, we will use the below command

sudo n current

More information on install command can be found in here.

Step 5: Check version installed

node -v

Update Nodejs using Brew package manager

It will be recommend to use this method if you have initially installed nodejs via brew.

Step 1: Update brew

brew update

Step 2: Update node

brew upgrade node

Conclusion

There is no need to be confuse about the method to update nodejs as it can be done with just a few commands.

Show Comments

No Responses Yet

Leave a Reply