It’s been 13 years since the first version of nodejs launched. There are many ways to update NodeJs version. I’ll guide you through most of them one by one. But from my experience, NVM is the most reliable way to update the nodejs version.
1. NVM – Recommended
- nvm is POSIX-compliant bash script. For Windows – nvm-windows
- It helps to manage multiple node version
- You can install it using curl or wget
- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash or wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
- Once it is installed,
- node -v to check the current version of nodejs
- nvm ls Already installed node versions in your system and the one you use currently.
- nvm ls-remote To list down all versions of Node.js available for installation
- nvm install x.x.x To install nodejs-specific version. Ex. nvm i 8.0.0
- nvm use x.x.x To switch nodejs version. Ex. nvm use 8.0.0
- n is simple nodejs version management npm package
- npm install n -g to install n
- n x.x.x – to install new nodejs version. Ex. n 8.0.0
- n – To list and switch among the nodejs versions
3. Official website
- Go to the official Node.js site, download, and execute the installer program. It will take care of everything.
4. Brew – macos