There are multiple ways to install Node.js; therefore, depending on how it was installed, there are numerous ways to update its version as well.
First, check which version of node is currently running on your system using the command:
node -v
There are three possible ways to update a Node.js version:
nvm
The node version manager nvm
is a popular way of running Node – it allows us to switch between various Node versions and install new versions.
To update using nvm
, use the following two commands:
nvm install <VERSION_NUMBER>
nvm use <VERSION_NUMBER>
Homebrew is another popular package installer on macOS. To update a Node.js version using Homebrew, use the following command:
brew upgrade node
The official Node.js downloads page includes pre-made installers for Windows and macOS; download and run these installers to update your version of Node.js. Newer versions of Node.js will automatically replace older versions.
Free Resources