How do I update Node.js?
I did the following to update my npm:
npm update npm -g
But I have no idea how to update Node.js. Any suggestions? (I'm using Node.js 0.4.1 and want to update to Node.js 0.6.1.)
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
I used the following instructions to upgrade from Node.js version 0.10.6 to 0.10.21 on a Mac.
Clear NPM's cache:
sudo npm cache clean -f
Install a little helper called 'n'
sudo npm install -g n
Install 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.
Update (June 2017):
This four years old post still receives up-votes so I'm guessing it still works for many people. However, Mr. Walsh himself recommended to update Node.js just using nvm instead.
So here's what you might want to do today:
Find out which version of Node.js you are using:
Find out which versions of Node.js you may have installed and which one of those you're currently using:
List all versions of Node.js available for installation:
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
Read more... Read less...
This is a simple solution that works for all supported operating systems* including Windows:
After a lot of surfing and not finding a straight solution, I just tried going to Node.js site, clicked the DOWNLOADS button on homepage and executed the installer program (MSI).
Thankfully it took care of everything and with a few clicks of 'Next' button I got the latest Node.js version running on my Windows machine.
(here is the original answer)
PS: To check your Node version use
npm version or
PPS: Keep an eye on NodeJS blog - Vulnerabilities so you don't miss important security releases.
PPPS: NodeJS installation includes npm (Node package manager).
All platforms (Windows, Mac & Linux)
Updated Sep 2020
Alternative 1: Through installer
Just go to nodejs.org and use the latest installer.
Alternative 2 : Through NPM
npm install -g npm stable
npm install -g node
That's it folks. It used to be more complex and people used different kinds of packages and strategies to manage it. But things have changed for the better.
npm install -g npm stable
npm install -g node or
npm install -g n
check after version installation,
node --version or