When it comes to installing Node JS on a system, there are multiple ways. As far as upgrading is concerned, how you first installed, it plays a big part. Let’s examine the update Node version in detail below.
Did you use the official package to install Node JS?
When it comes to installing Node.js, it is always better to download the original version from the official Node.js website.
As far as the official package is concerned, it can detect an existing version of Node.js. In that case, it will overwrite the version that exists.
Have you installed Node.js using Homebrew?
When it comes to installing Node.js on a Mac, you can go for Homebrew for the same purpose.
Well, the best thing about Homebrew is that the whole installation process is rather simple.
brew update #makes sure Homebrew is up to date
brew upgrade node
To compile the package, Homebrew might ask you to upgrade the xCode version.
When you use nvm ?
To run the node, many people use
nvm. The best thing about nvm is that it allows you to switch the Node version. In case something goes wrong, you can rollback without any difficulty thanks to nvm.
Also, you can test your code on all the previous Node versions as well thanks to this.
If you wish to check the current version, you can go for the command nvm current. It will give you the same output for
To have a list of all the versions that have been installed, run nvm ls.
With the help of nvm install
nvm install 10.8.3
Once you are done with the installation, you can set the version by typing:
nvm use 10.8.3
With this command, 10.8.3 will be set as the default Node version.