This question's answers are a community effort. Edit existing answers to improve this post. It is not currently accepting new answers or interactions.
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.)
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 -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.
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 available from cmd or gitbash or powershell, this will list all available version of node
use command nvm install version e.g. nvm install 12.14.0 to install on the machine
last once installed use nvm use version to use newer version e.g. nvm use 12.14.0
Any OS (including Windows, Mac & Linux)
Updated October 2022
Just go to the official Node.js site (nodejs.org), download and execute the installer program.
It will take care of everything and with a few clicks of 'Next' you'll get the latest Node.js version running on your machine. Since 2020 it's the recommended way to update NodeJS. It's the easiest and least frustrating solution.
Pro tips
NodeJS installation includes NPM (Node package manager).
To check your NPM version use npm version or node --version.
If you prefer CLI, to update NPM use npm install -g npm and then npm install -g node.
For more details, see the docs for install command.
Keep an eye on NodeJS blog - Vulnerabilities so you don't miss important security releases. Keep your NodeJS up-to-date.
Operating systems supported by Node.js:
Windows, Linux, MacOS, IBM AIX.
For Docker users, here's the official Node.js image.
For more information on installing Node.js on a variety of less-common operating systems, see this page (there's even Node for Android!).
Troubleshooting for Windows:
If anyone gets file error 2502/2503 like myself during install, run
the .msi via Administrator command prompt with command msiexec /package [node msi]
If my answer is helpful, don't forget to upvote it
(here is the original answer by Anmol Saraf, upvote it too)
If you have Homebrew installed (only for macOS):
$ brew upgrade node
2021: Just go to nodejs.org and use the latest installer.
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.
Works for all platforms (Windows, Mac & Linux).
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
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.
To upgrade node to the latest version or to a specific version you can do the following:
sudo npm install n -g
sudo n 0.10.18 // This will give you the specific version
For the latest stable version:
sudo n stable
For the latest LTS version(Tested on Mac)
sudo n lts
To control your version of Node.js, you can try n. I found it very straightforward and useful.
n is a Node.js binary management, no subshells, no profile setup, no convoluted API, just simple.
npm install -g n
n 0.6.19 will install Node.js v0.6.19.
Short answer:
Go to this page: Download | Node.js
Download the installer for your platform, then install it.
I had the same problem, when I saw that my Node.js installation is outdated.
These few lines will handle everything (for Ubuntu):
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
After this node -v will return you the latest available version.
On CentOS 7 you can do the following:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
sudo ln -sf /usr/local/n/versions/node/5.4.1/bin/node /usr/bin/node
node –v (Should show updated version now)
npm rebuild node-sass (Optional: if you use this)
Note: The symlink is required to link your node binary with the latest Node.js installed binary file.
For OS X, I had v5.4.1 and needed the latest version 6 so I went to the Node.js homepage and clicked on one of the links below:
I then followed the installer and then I magically had the latest version of Node.js and npm.
For macOS in 2018+
(as ALL of the solutions above are failing for me):
Simply go to the official nodejs site, download the official nodejs package and install it by double clicking. It's the most simple, safe and always-working thing you can do.
You may use nvm.
Check what is the latest version at http://nodejs.org/ (e.g. v0.10.26)
Run nvm install v0.10.26
Done.
You can choose which version to run:
nvm ls list the available versions and tells you which version you are using now.
nvm use VERSION change the current node to the requested version.
nvm alias default VERSION set the default version. The next time you source nvm.sh, this will be the version loaded (note that it doesn't change the version in use right now, run nvm use for that).
Some Linux distributions such as Arch Linux have Node.js in their package repositories. On such systems it is better to use a standard package update procedure, such as pacman -Suy or analogous apt-get or yum commands.
As of now (Nov 2016) EPEL7 offers a pretty recent version of Node.js (6.9.1 which is an up-to-date LTS version offered on the Node.js home page). So on CentOS 7 and derivatives you can just add EPEL repository by yum install epel-release and yum install nodejs.
CentOS 6/EPEL6 has 0.10.x which isn't supported upstream since Oct 2016.
Today I ran on a Windows Git Bash:
$ npm i node -g
and got the following output:
> node#10.6.0 preinstall C:\Users\X\AppData\Roaming\npm\node_modules\node
> node installArchSpecificPackage
+ node-win-x64#10.6.0
added 1 package and audited 1 package in 23.368s
found 0 vulnerabilities
C:\Users\X\AppData\Roaming\npm\node -> C:\Users\X\AppData\Roaming\npm\node_modules\node\bin\node
+ node#10.6.0
added 2 packages from 1 contributor in 26.089s
Read more about it at https://www.npmjs.com/package/node.
The easy way to update node and npm :
npm install -g npm#latest
download the latest version of node js and update /install
$ npm install -g npm stable
worked for me to update npm
Install nvm(cURL)
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash
OR with Wget
$ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
Display list of installed versions
$ nvm ls
Display list of versions that are available to install
$ nvm ls-remote
Install your preferred version
$ nvm install v7.5.0
Set this version as the default
$ nvm alias default v7.5.0
For Ubuntu:
sudo apt-get install -y curl
curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
sudo apt-get install -y nodejs
Source: https://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version
You may use Chocolatey on Windows. It's very easy to use and useful for keeping you updated with other applications too.
Also, you can just simply download the latest version from https://nodejs.org and install it.
According to Nodejs Official Page, you can install&update new node version on windows using Chocolatey or Scoop
Using(Chocolatey):
cinst nodejs
# or for full install with npm
cinst nodejs.install
Using(Scoop):
scoop install nodejs
Also you can download the Windows Installer directly from the nodejs.org web site
As some of you already said, the easiest way is to update Node.js through the Node.js package manager, npm. If you are a Linux (Debian-based in my case) user I would suggest to add these lines to your .bashrc file (in home directory):
function nodejsupdate() {
ARGC=$#
version=latest
if [ $ARGC != 0 ]; then
version=$1
fi
sudo npm cache clean -f
sudo npm install -g n
sudo n $version
}
Restart your terminal after saving and write nodejsupdate to update to the latest version of Node.js or nodejsupdate v6.0.0 (for example) to update to a specific version of Node.js.
BONUS: Update npm (add these lines to .bashrc)
function npmupdate() {
sudo npm i npm -g
}
After restarting the terminal write npmupdate to update your node package manager to the latest version.
Now you can update Node.js and npm through your terminal (easier).
In windows download the node executable file from the website and install it. this worked for me.
All you need to version update of Node.js:
$ brew install node
If you don't have Homebrew; please go http://brew.sh/.
Just install the new version over the current folder. I upgraded mine from v4.x to v6.10 on Windows.
npm clean cache - you forget to clean ur cache
npm update -g
This works on mine Windows, I hope it will also work for you :D
If you want to update Node.js, just try
npm update
from your Windows cmd prompt.
Else if you want to update any specific package try
npm update <package_name>
Example:
npm update phonegap
open cmd and type
npm i -g npm
Related
This question's answers are a community effort. Edit existing answers to improve this post. It is not currently accepting new answers or interactions.
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.)
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 -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.
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 available from cmd or gitbash or powershell, this will list all available version of node
use command nvm install version e.g. nvm install 12.14.0 to install on the machine
last once installed use nvm use version to use newer version e.g. nvm use 12.14.0
Any OS (including Windows, Mac & Linux)
Updated October 2022
Just go to the official Node.js site (nodejs.org), download and execute the installer program.
It will take care of everything and with a few clicks of 'Next' you'll get the latest Node.js version running on your machine. Since 2020 it's the recommended way to update NodeJS. It's the easiest and least frustrating solution.
Pro tips
NodeJS installation includes NPM (Node package manager).
To check your NPM version use npm version or node --version.
If you prefer CLI, to update NPM use npm install -g npm and then npm install -g node.
For more details, see the docs for install command.
Keep an eye on NodeJS blog - Vulnerabilities so you don't miss important security releases. Keep your NodeJS up-to-date.
Operating systems supported by Node.js:
Windows, Linux, MacOS, IBM AIX.
For Docker users, here's the official Node.js image.
For more information on installing Node.js on a variety of less-common operating systems, see this page (there's even Node for Android!).
Troubleshooting for Windows:
If anyone gets file error 2502/2503 like myself during install, run
the .msi via Administrator command prompt with command msiexec /package [node msi]
If my answer is helpful, don't forget to upvote it
(here is the original answer by Anmol Saraf, upvote it too)
If you have Homebrew installed (only for macOS):
$ brew upgrade node
2021: Just go to nodejs.org and use the latest installer.
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.
Works for all platforms (Windows, Mac & Linux).
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
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.
To upgrade node to the latest version or to a specific version you can do the following:
sudo npm install n -g
sudo n 0.10.18 // This will give you the specific version
For the latest stable version:
sudo n stable
For the latest LTS version(Tested on Mac)
sudo n lts
To control your version of Node.js, you can try n. I found it very straightforward and useful.
n is a Node.js binary management, no subshells, no profile setup, no convoluted API, just simple.
npm install -g n
n 0.6.19 will install Node.js v0.6.19.
Short answer:
Go to this page: Download | Node.js
Download the installer for your platform, then install it.
I had the same problem, when I saw that my Node.js installation is outdated.
These few lines will handle everything (for Ubuntu):
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
After this node -v will return you the latest available version.
On CentOS 7 you can do the following:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
sudo ln -sf /usr/local/n/versions/node/5.4.1/bin/node /usr/bin/node
node –v (Should show updated version now)
npm rebuild node-sass (Optional: if you use this)
Note: The symlink is required to link your node binary with the latest Node.js installed binary file.
For OS X, I had v5.4.1 and needed the latest version 6 so I went to the Node.js homepage and clicked on one of the links below:
I then followed the installer and then I magically had the latest version of Node.js and npm.
For macOS in 2018+
(as ALL of the solutions above are failing for me):
Simply go to the official nodejs site, download the official nodejs package and install it by double clicking. It's the most simple, safe and always-working thing you can do.
You may use nvm.
Check what is the latest version at http://nodejs.org/ (e.g. v0.10.26)
Run nvm install v0.10.26
Done.
You can choose which version to run:
nvm ls list the available versions and tells you which version you are using now.
nvm use VERSION change the current node to the requested version.
nvm alias default VERSION set the default version. The next time you source nvm.sh, this will be the version loaded (note that it doesn't change the version in use right now, run nvm use for that).
Some Linux distributions such as Arch Linux have Node.js in their package repositories. On such systems it is better to use a standard package update procedure, such as pacman -Suy or analogous apt-get or yum commands.
As of now (Nov 2016) EPEL7 offers a pretty recent version of Node.js (6.9.1 which is an up-to-date LTS version offered on the Node.js home page). So on CentOS 7 and derivatives you can just add EPEL repository by yum install epel-release and yum install nodejs.
CentOS 6/EPEL6 has 0.10.x which isn't supported upstream since Oct 2016.
Today I ran on a Windows Git Bash:
$ npm i node -g
and got the following output:
> node#10.6.0 preinstall C:\Users\X\AppData\Roaming\npm\node_modules\node
> node installArchSpecificPackage
+ node-win-x64#10.6.0
added 1 package and audited 1 package in 23.368s
found 0 vulnerabilities
C:\Users\X\AppData\Roaming\npm\node -> C:\Users\X\AppData\Roaming\npm\node_modules\node\bin\node
+ node#10.6.0
added 2 packages from 1 contributor in 26.089s
Read more about it at https://www.npmjs.com/package/node.
The easy way to update node and npm :
npm install -g npm#latest
download the latest version of node js and update /install
$ npm install -g npm stable
worked for me to update npm
Install nvm(cURL)
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash
OR with Wget
$ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
Display list of installed versions
$ nvm ls
Display list of versions that are available to install
$ nvm ls-remote
Install your preferred version
$ nvm install v7.5.0
Set this version as the default
$ nvm alias default v7.5.0
For Ubuntu:
sudo apt-get install -y curl
curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
sudo apt-get install -y nodejs
Source: https://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version
You may use Chocolatey on Windows. It's very easy to use and useful for keeping you updated with other applications too.
Also, you can just simply download the latest version from https://nodejs.org and install it.
According to Nodejs Official Page, you can install&update new node version on windows using Chocolatey or Scoop
Using(Chocolatey):
cinst nodejs
# or for full install with npm
cinst nodejs.install
Using(Scoop):
scoop install nodejs
Also you can download the Windows Installer directly from the nodejs.org web site
As some of you already said, the easiest way is to update Node.js through the Node.js package manager, npm. If you are a Linux (Debian-based in my case) user I would suggest to add these lines to your .bashrc file (in home directory):
function nodejsupdate() {
ARGC=$#
version=latest
if [ $ARGC != 0 ]; then
version=$1
fi
sudo npm cache clean -f
sudo npm install -g n
sudo n $version
}
Restart your terminal after saving and write nodejsupdate to update to the latest version of Node.js or nodejsupdate v6.0.0 (for example) to update to a specific version of Node.js.
BONUS: Update npm (add these lines to .bashrc)
function npmupdate() {
sudo npm i npm -g
}
After restarting the terminal write npmupdate to update your node package manager to the latest version.
Now you can update Node.js and npm through your terminal (easier).
In windows download the node executable file from the website and install it. this worked for me.
All you need to version update of Node.js:
$ brew install node
If you don't have Homebrew; please go http://brew.sh/.
Just install the new version over the current folder. I upgraded mine from v4.x to v6.10 on Windows.
npm clean cache - you forget to clean ur cache
npm update -g
This works on mine Windows, I hope it will also work for you :D
If you want to update Node.js, just try
npm update
from your Windows cmd prompt.
Else if you want to update any specific package try
npm update <package_name>
Example:
npm update phonegap
open cmd and type
npm i -g npm
I want to update my Node js to the current LTS version on my windows 7. Do I just let the current version be, and install the latest version from the website? Or do I need to delete the currently installed node? If so, how do I do that?
The best way to have multiple versions of Node is by using nvm.
Nvm for Windows (guide)
Nvm for Windows (GitHub repo)
Goto https://nodejs.org/en/download/
Download the version you want, for instance msi for windows. Run the download and it will update the version to the one you have downloaded.
If you install the latest stable version. Please use the below comments with the administrator command prompt
nvm install lts
Once complete the installation. You received the message
Downloading node.js version 16.15.1 (64-bit)...
Extracting...
Complete
Installation complete. If you want to use this version, type
nvm use 16.15.1
next step
nvm use 16.15.1
I believe that since npm installs Node.JS as a package (just like it would React or any other package) to your project, you can just 'npm install node' to get the latest version.
If you're looking for npm, the NPM website says this:
To update your npm, type this into your terminal:
npm install npm#latest -g
Follow https://phoenixnap.com/kb/update-node-js-version you can find several ways to update the node.
Install nvm by running:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash in bash
or
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
Then run the editor as administrator :
nvm install 14.18.1 (example the node version that you want or use lts for the latest)
nvm use 14.18.1
Make sure the node version to be used is the one installed after nvm install. If you already have one, delete it first.
node -v will give 14.18.1
I have Node version v6.10.0 with Node Express 4.14.1. I want to upgrade Node version to 7.6 or 8 to make use of async await features.
However, I'm not sure if it is as simple as update node with the command line or if there is something I should be aware of before migrating.
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
I have not found any migration guide on the site, github or whatsoever Internet.
Is it as simple as that as running a terminal instruction and done?
Try Using nvm,using nvm,We can easily switch between different versions of node js.
To Download nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
Install a Particular Version Of Node
nvm install version
Use a Node Version
nvm use version
Is it possible to update node using command line/PowerShell in windows 10?
Surely, I can download the latest version from the official site and install, but, I'm hoping for a way to do it from cmd.
Right now, I've npm and yarn installed on my system if that helps.
Perhaps nvm-windows is what you are looking for.
After installing this program on your computer, you will be able to use nvm command (Node Version Manager) in windows command line and manipulate with node.js versions.
Commands that you probably need are:
nvm install latest: To install the latest stable version
nvm list available: Show a list of versions available for download.
nvm use <version>: Switch to use the specified version.
More information here
Since you have npm you can use this command in powershell:
npm install npm#latest -g
If you want documentation to refer to you can use:
npmjs documentation
I am running Node.js version v0.5.9-pre on Ubuntu 10.10.
I would like to be using version v0.5.0-pre.
How do I roll back to the older version of node?
*NIX (Linux, OS X, ...)
Use n, an extremely simple Node version manager that can be installed via npm.
Say you want Node.js v0.10.x to build Atom.
npm install -g n # Install n globally
n 0.10.33 # Install and use v0.10.33
Usage:
n # Output versions installed
n latest # Install or activate the latest node release
n stable # Install or activate the latest stable node release
n <version> # Install node <version>
n use <version> [args ...] # Execute node <version> with [args ...]
n bin <version> # Output bin path for <version>
n rm <version ...> # Remove the given version(s)
n --latest # Output the latest node version available
n --stable # Output the latest stable node version available
n ls # Output the versions of node available
Windows
Use nvm-windows, it's like nvm but for Windows. Download and run the installer, then:
nvm install v0.10.33 # Install v0.10.33
nvm use v0.10.33 # Use v0.10.33
Usage:
nvm install [version] # Download and install [version]
nvm uninstall [version] # Uninstall [version]
nvm use [version] # Switch to use [version]
nvm list # List installed versions
One way is to use NVM, the Node Version Manager.
Use following command to get nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
You can find it at https://github.com/creationix/nvm
It allows you to easily install and manage multiple versions of node. Here's a snippet from the help:
Usage:
nvm install <version> Download and install a <version>
nvm use <version> Modify PATH to use <version>
nvm ls List versions (installed versions are blue)
Update: Updated the answer because previous one was not relevant.
Follow below steps to update your node version.
1. Install nvm For this run below command in your terminal
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
Note: If above command did not work for you, you can choose another option to install it. I have added an answer for this here
2. Install specific node version using nvm
For this run
Replace 12.14.1 with your node version
nvm install 12.14.1
Note: If you are getting error of NVM not recognised then run below command and then run above again
source ~/.nvm/nvm.sh
3. Make the installed version default
Note: Replace 12.14.1 with your installed version.
nvm alias default 12.14.1
and
nvm use 12.14.1
4. Check node version
node -v
And that's it.
Extra
To check list of installed node versions -- run below command
nvm ls
Why use any extension when you can do this without extension :)
Install specific version of node
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
Specific version : sudo n 4.4.4 instead of sudo n stable
With package.json - The Maintainable and Portable Way 🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉
Lets each project specify its own version
You can add node as a dependency in package.json and control which version is used for a particular project. Upon executing a package.json "script", npm (and yarn) will use that version to run the script instead of the globally installed Node.js.
The node package accomplishes this by downloading a node binary for your local system and puts it into the node_modules/.bin directory.
You can also do this with the npm (or yarn) packages but you'll need to set your PATH up specifically or use something like npx that handles it for you.
Ubuntu - The Official Way (manually) 😵
If you're on node 12 and want to downgrade to node 10, just remove node and follow the instructions for the desired version:
# Remove the version that is currently installed
sudo apt remove -y nodejs
# Setup sources for the version you want
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
# (Re-)Install Node
sudo apt-get install -y nodejs
Windows - The Official Way (manually) 😵
I found myself wanting to downgrade to LTS on Windows from the bleeding edge. If you're not using a package manager like Chocolatey or a node version manager like nvm or n, just download the .msi for the version you want and install it. You might want to remove the currently installed version via "Add or remove programs" tool in Windows.
Windows Package Manager - winget 🎉🎉
The Open Source Windows Package Manager Way
winget install -e --id OpenJS.Nodejs -v 14.9.0
Chocolatey - The Independent Package Manager Way 🎉
Chocolatey is good for keeping installations up to date easily and it is a common way to install Node.js on Windows. I had to remove the bleeding edge version before installing the LTS version:
choco uninstall nodejs
choco install nodejs-lts
Node Version Manager - The "Screw it, I'll do it myself!" Way 😢😢😢😭😭😭😭😭
While not very portable or easily maintainable, some developers like manually switching which global version of node is active at any given point in time and think the official ways of doing this are too slow. There are two popular Npm packages that provide helpful CLI interfaces for selecting (and automatically installing) whichever version you want for your system: nvm and n. Using either is beyond the scope of this answer.
I highly recommend staying away from this option. Even though it's popular, it's an anti-pattern that is sure to cause headaches in the future. Sure, .nvmrc exists, but this is reinventing something that's already a part of Npm. Just npm i node the version you want.
Windows
Downgrade Node with Chocolately
Install Chocolatey. Then run:
choco install nodejs.install -version 6.3.0
Chocolatey has lots of Node versions available.
Downgrade NPM
npm install -g npm#3.10.3
the easiest way i have found is to just use the nodejs.org site:
go to https://nodejs.org/en/download/releases/
find version you want and click download
on mac click the .pkg executable and follow the installation instructions (not sure what the correct executable is for windows)
be happy now that you are on the version of node you wanted
nvmw is no longer maintained, but I found another source that seems to be up to date (as of 1/4/17).
nvm-windows
It works. Allowed me to downgrade to 6.3.1
You need to install NVM for this.
For Mac
Edit .bash_profile using the below command.
nano .bash_profile
And add the following lines to .bash_profile
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
Save it. Exit the terminal and check the magic.
Then install the required version using the below command.
nvm install v14.18.0
If you want to check the installed node versions on your system. Use the below command.
nvm ls
If you want to use the specific version from the installed node versions. Use below command
nvm use 12.14.4
Another good library for managing multiple versions of Node is N: https://github.com/visionmedia/n
On windows 7 I used the general 'Uninstall Node.js' (just started typing in the search bottom left ,main menu field) followed by clicking the link to the older version which complies with the project, for instance:
Windows 64-bit Installer: https://nodejs.org/dist/v4.4.6/node-v4.4.6-x64.msi
I had node version 6.4.0 .
As i am need of the older version 6.3.0 , i just installed the 6.3.0 version again in my system. node version downgraded automatically.
So, to downgrade the node version ,
Just install the older version of node js . It will get downgraded automatically from the higher version.
I tried in osx . It works like a charm .
Now the v0.5.0-pre has reached end of life. We can use npx to use any stable older version of node. E.g. the earliest stable version is 4.9.0.
npx -p node#4.9.0 -- node -v
run this:
rm -rf node_modules && npm cache clear && npm install
Node will install from whatever is cached. So if you clear everything out first, then NPM use 0.10.xx, it will revert properly.
Easiest way i found -
Uninstall current version
Download the appropriate .msi installer (x64 or x86) for the desired version from https://nodejs.org/download/release/
Use following commnad with your version number
nvm install v8.9
nvm alias default v8.9
nvm use v8.9
For some reason Brew installs node 5 into a separate directory called node5.
The steps I took to get back to version 5 were: (You will need to look up standard brew installation/uninstallation, but otherwise this process is more straightforward than it looks.)
Install node5 using Brew standard installation, BUT don't brew link, yet.
Uninstall all other versions of node using brew unlink node and brew uninstall node. You might need to use --force to remove one of the versions.
Find the cellar folder on your computer
Delete the node folder in the cellar.
Rename the node5 folder to node.
Then, brew link node
You should be all set with node 5.
If you are like, you already install node version you want but can't seem to switch to it, try this:
nvm use --delete-prefix <version>. npm shows the lates version installed but can't switch to it. If so, this is the output you will see:
You need to run "nvm install v16.2.0
Then run:nvm install <type the version you wish to use here>Your output should look like this:
Downloading and installing node v16.2.0... Downloading https://nodejs.org/dist/v16.2.0/node-v16.2.0-linux-x64.tar.xz... ####################################################################### 100.0% Computing checksum with sha256sum Checksums matched! Now using node v16.2.0 (npm v7.13.0) Creating default alias: default -> v16.2.0
You are done! You can see the latest version by running:
node -v
if you want to go to the LTS version of node which is the stable one from the latest/current version simply run this in your directory.
npm i node
this will install the LTS version of node in your directory.
I faced a lot of issue with this and the only solution that worked for me is :
source ~/.nvm/nvm.sh
nvm isntall node_version_you_want
nvm use node_version_you_want
nvm install 0.5.0 #install previous version of choice
nvm alias default 0.5.0 #set it to default
nvm use default #use the new default as active version globally.
Without the last, the active version doesn't change to the new default. So, when you open a new terminal or restart server, the old default version remains active.
follow the steps if u already install curl its work for me
sudo snap remove curl
sudo apt install curl
nvm install 12.2.0
As i can see this was asked a long time ago, but maybe it can be helpful for someone else.
I can recommend this utility (NVS - Node Version Switcher) to someone who is searching for a way to switching between different versions of NodeJS:
https://github.com/jasongin/nvs
The Easiest way I find to install node.js with a specific version:
First uninstall your node.js
Go to, https://nodejs.org/en/download/releases/ and find your desired version.
Select your version and click on the download button.
Download .msi file