xxxxxxxxxx
//First, clear the npm cache:
npm cache clean -f
//Install n, Node’s version manager:
npm install -g n
//With the n module installed, you can use it to:
Install the latest stable version: n stable
Install the latest release: n latest
xxxxxxxxxx
#linux
sudo npm install n -g
sudo n stable
#windows
#install the .msi from https://nodejs.org/en/download/
xxxxxxxxxx
## Install n
npm install -g n
// You'll need to install this package globally as it manages
// the Node versions at the root.
## Install a new version of Node
n lts
// or
n latest
// The two commands above install the long-term support
// and latest versions of Node.
## Remove previously installed versions
n prune
// This command removes the cached versions of
// the previously installed versions and only keeps
// the latest installed version.
xxxxxxxxxx
None of the other answers work on Windows. Go to link below and download.
https://nodejs.org/en
xxxxxxxxxx
# Using Ubuntu
curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
sudo apt-get install -y nodejs
# Using Debian, as root
curl -fsSL https://deb.nodesource.com/setup_current.x | bash -
apt-get install -y nodejs