Skip to content

Instantly share code, notes, and snippets.

@debojyoti
Last active July 19, 2019 07:07
Show Gist options
  • Save debojyoti/9e5b2ec6acd36b013b9aefefcdf8e1be to your computer and use it in GitHub Desktop.
Save debojyoti/9e5b2ec6acd36b013b9aefefcdf8e1be to your computer and use it in GitHub Desktop.

Play with multiple versions of node (in linux)

Install nvm (node version manager)

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

Note: Please avoid to install Node.js with apt-get on Ubuntu. If you already installed Node.js with the built in package manager, please remove that. Run the following commands: sudo apt-get purge nodejs sudo apt-get autoremove && sudo apt-get autoclean

Manage node versions

To list all installed vesrions

nvm list

To install a specific vesrion

nvm install v10.15.1

To list all available vesrions

nvm list-remote

You can also view them here: https://nodejs.org/en/download/releases/

To use a specific version

nvm use v10.15.1

To view current node version

node -v

To set default node version

nvm alias default 6.1.0

To install npm

sudo apt install npm

Happy playing!

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