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.
- Using N package
- 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
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
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
Step 2: Update node
brew upgrade node
There is no need to be confuse about the method to update nodejs as it can be done with just a few commands.
No Responses Yet