Advertisement
Advertisement


How do I update Node.js?


Question

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.)

2017/11/08
1
743
11/8/2017 8:57:32 PM

Accepted Answer

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

  1. download nvm-setup.zip extract and install it.
  2. execute command nvm list available from cmd or gitbash or powershell, this will list all available version of node enter image description here
  3. use command nvm install version e.g. nvm install 12.14.0 to install on the machine
  4. last once installed use nvm use version to use newer version e.g. nvm use 12.14.0
2019/12/30
500
12/30/2019 5:19:09 AM


If you have Homebrew installed (only for macOS):

$ brew upgrade node
2019/11/17

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)

Download NodeJS for Linux buttons

Download NodeJS for Win/Mac/Source Code buttons

For Docker users, here's the official Node.js image.


PS: To check your Node version use npm version or node --version.
PPS: Keep an eye on NodeJS blog - Vulnerabilities so you don't miss important security releases.
PPPS: NodeJS installation includes npm (Node package manager).

* Operating systems supported by Node.js: Windows, Linux, MacOS, SunOS, IBM AIX

2020/07/06

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.

2020/09/02

First update npm,

npm install -g npm stable

Then update node,

npm install -g node or npm install -g n

check after version installation,

node --version or node -v

2019/02/14

On Windows you can use Chocolatey to install and update Node.js (and lots of other packages).

Install Node

cinst nodejs.install

Update Node

cup nodejs.install

Note: You will need to install Chocolatey before you can use cinst and cup.

2017/11/08

Source: https://stackoverflow.com/questions/8191459
Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Email: [email protected]