How to update node using nvm

I installed node.js version 5.0 with nvm , but now I want to upgrade it to 5.4.

Is there no way to update node directly in place, instead of installing the latest stable version? I do not want to lose all these global packages and I will say npm install grunt-cli bower yo yoman-angular-generator blablablablablabla...

+74
npm nvm
Jan 15 '16 at 11:54 on
source share
4 answers

This should work:

 nvm install NEW_VERSION --reinstall-packages-from=OLD_VERSION 

For example:

 nvm install 6.7 --reinstall-packages-from=6.4 

then if you want you can uninstall your previous version with

 nvm uninstall OLD_VERSION 

Where, in your case, NEW_VERSION = 5.4 OLD_VERSION = 5.0

+112
Jan 15 '16 at 12:16
source share

You can more easily run nvm install node --reinstall-packages-from=node which will install the latest stable version and reinstall all packages from the current version of node. This eliminates the need to manually process certain versions.

+46
Dec 13 '16 at 12:48
source share

if you have 4.2 and want to install 5.0.0, then

 nvm install v5.0.0 --reinstall-packages-from=4.2 

gabrielperales answer is correct, except that he missed the "=" sign at the end. if you do not put the "=" sign, then a new version of node will be installed, but packages will not be installed.

source: sitepoint

+4
Oct 14 '16 at 16:11
source share

⚑ TWO strong> Simple solutions:

To install the latest version of node and reinstall the packages of the old version, run the following command.

 nvm install node --reinstall-packages-from=node 

To install the latest version of lts long-term-support node and reinstall the old version packages, run the following command.

 nvm install lts/* --reinstall-packages-from=node 

Here's a GIF to support this answer. nvm

+1
Nov 14 '17 at 22:21
source share



All Articles