Skip to content

Instantly share code, notes, and snippets.

@frenchbread
Last active November 14, 2020 17:53
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save frenchbread/d70cb4529073f5196faf7bd2e0464fb5 to your computer and use it in GitHub Desktop.
Save frenchbread/d70cb4529073f5196faf7bd2e0464fb5 to your computer and use it in GitHub Desktop.
Update Node.js with NVM and keep packages

Update Node.js with NVM and keep packages

Usually when new version of Node.js comes out and you update it by just installing new and removing old one, all of your global NPM packages are gone. Here is how to update to new version of Node and reinstall packages:

Command

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

Usage example

$ nvm install 7.4.0 --reinstall-packages-from=7.3.0

And uninstall old version

$ nvm uninstall OLD_VERSION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment