Skip to content

Instantly share code, notes, and snippets.

@sandrabosk
Created April 29, 2020 18:59
Show Gist options
  • Save sandrabosk/e18599975524a8aaa22ee5ed917a7222 to your computer and use it in GitHub Desktop.
Save sandrabosk/e18599975524a8aaa22ee5ed917a7222 to your computer and use it in GitHub Desktop.

[LIN] Install nvm

nvm is a terminal command that allows you to install and change between different versions of Node.js. Usually, your system can have only one version of Node.js installed at one time. With nvm, you can switch to a newer version, try some new features, and then back to an older version for your more serious projects.

  • Run these commands one by one in your terminal:
$ mkdir ~/.nvm
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
  • Use your editor to open your terminal settings file (.zshrc or .bash_profile):
$ code ~/$([ -n "$ZSH_VERSION" ] && echo ".zshrc" || echo ".bash_profile")
  • In your editor, copy/paste these lines and save:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
  • Close and reopen all your terminal windows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment