2026 Update: Use FNM
fnm is a fully rust based node.js version manager and 10x faster than nvm. Works on Windows, Mac and Linux unlike nvm
Check which version of fnm is installed
fnm --version
- install a specific version of node
fnm install 22.12.10
- use a specific version of node
fnm use 22.12.10
- Check out all the fnm commands here
Older answer with nvm
To upgrade Node you may first want to see which version of Node.js you are currently using:
node --version
Find out which versions of Node.js you may have installed and which one of those you're currently using:
nvm ls
List all versions of Node.js available for installation:
nvm ls-remote
Apparently for Windows the command would be rather like this:
nvm ls available
Assuming you would pick Node.js v8.1.0 for installation you'd type the following to install that version:
nvm install 8.1.0
You are then free to choose between installed versions of Node.js. So if you would need to use an older version like v4.2.0 you would set it as the active version like this:
nvm use 4.2
That should be all.
In 2013 I used the following instructions to upgrade from Node.js version 0.10.6 to 0.10.21 on a Mac, for more recent instructions see above.
Update from 2017: Please mind, Mr. Walsh himself recommended to update Node.js just using nvm instead.
Clear NPM's cache:
sudo npm cache clean -fInstall a little helper called 'n'
sudo npm install -g nInstall latest stable Node.js version
sudo n stable
Alternatively pick a specific version and install like this:
sudo n 0.8.20
For production environments you might want to pay attention to version numbering and be picky about odd/even numbers.
Credits
- General procedure: D.Walsh
- Stable/unstable versions: P.Teixeira
2026 Update: Use FNM
fnm is a fully rust based node.js version manager and 10x faster than nvm. Works on Windows, Mac and Linux unlike nvm
Check which version of fnm is installed
fnm --version
- install a specific version of node
fnm install 22.12.10
- use a specific version of node
fnm use 22.12.10
- Check out all the fnm commands here
Older answer with nvm
To upgrade Node you may first want to see which version of Node.js you are currently using:
node --version
Find out which versions of Node.js you may have installed and which one of those you're currently using:
nvm ls
List all versions of Node.js available for installation:
nvm ls-remote
Apparently for Windows the command would be rather like this:
nvm ls available
Assuming you would pick Node.js v8.1.0 for installation you'd type the following to install that version:
nvm install 8.1.0
You are then free to choose between installed versions of Node.js. So if you would need to use an older version like v4.2.0 you would set it as the active version like this:
nvm use 4.2
That should be all.
In 2013 I used the following instructions to upgrade from Node.js version 0.10.6 to 0.10.21 on a Mac, for more recent instructions see above.
Update from 2017: Please mind, Mr. Walsh himself recommended to update Node.js just using nvm instead.
Clear NPM's cache:
sudo npm cache clean -fInstall a little helper called 'n'
sudo npm install -g nInstall latest stable Node.js version
sudo n stable
Alternatively pick a specific version and install like this:
sudo n 0.8.20
For production environments you might want to pay attention to version numbering and be picky about odd/even numbers.
Credits
- General procedure: D.Walsh
- Stable/unstable versions: P.Teixeira
Use Node Version Manager (NVM)
It's a Bash script that lets you download and manage different versions of node. Full source code is here.
There is a separate project for nvm for Windows: github.com/coreybutler/nvm-windows
Below are the full steps to use NVM for multiple version of node on windows
- download nvm-setup.zip extract and install it.
- execute command
nvm list availablefrom cmd or gitbash or powershell, this will list all available version of node - use command
nvm install versione.g.nvm install 12.14.0to install on the machine - last once installed use
nvm use versionto use newer version e.g.nvm use 12.14.0
How to update node on my WSL Ubuntu?
Update a node to Last version without modifying all the others
How to update Node.js under homebridge? UI
Open terminal in the Homebridge UI and then use this command: sudo hb-service update-node
Source: https://github.com/homebridge/homebridge/wiki/How-To-Update-Node.js
More on reddit.comHow do I update npm and Node.js to the latest versions? - LambdaTest Community
Videos
Use n module from npm in order to upgrade node
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
To upgrade to latest version (and not current stable) version, you can use
sudo n latest
Fix PATH:
sudo apt-get install --reinstall nodejs-legacy # fix /usr/bin/nodeTo undo:
sudo n rm 6.0.0 # replace number with version of Node that was installed sudo npm uninstall -g n
You may need to restart your terminal to see the updated node version.
Found in David Walsh blog
NodeSource provides binary distributions of Node.js; complete installation instructions can be found here. The instructions have been copied below for your reference. Instructions are the same for updating to the latest version.
Run once:
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
Run whenever you want to change the major version of Node.js:
NODE_MAJOR=20
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
sudo apt-get update
sudo apt-get install nodejs -y
Prior to August 2023: Previously versions of this answer involved the use of a series of setup_XX.x scripts that you'd run to install/update Node.js:
curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
sudo apt-get install -y nodejs
But as @eis pointed out, these scripts are no longer supported. To see the previous answers, please look at the edit history for this answer.
I have downloaded node on my win and it shows 20.11.1 while using node -v command. but when I use the same command on wsl ubuntu it shows v10.19.0. how to update it on wsl?
installed node using sudo apt install node
I have a plug in (Harmony Hub) won't update due to older version of Node.js installed.
I can see that Node.js version is v10.15.2 and v12.16.2 is available, how do I update it? do I have to use the terminal? is there a update button I'm missing?
Open terminal in the Homebridge UI and then use this command: sudo hb-service update-node
Source: https://github.com/homebridge/homebridge/wiki/How-To-Update-Node.js
It's really important you update Node.js using the same method you originally used to install it, otherwise you are likely to end up with multiple copies of Node.js installed which will cause confusion and unexpected results.
https://github.com/homebridge/homebridge/wiki/How-To-Update-Node.js