Skip to content

Instantly share code, notes, and snippets.

@ybhwang
Created March 20, 2022 09:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ybhwang/def320ab03bb0fcc037b8a7a94ca08f0 to your computer and use it in GitHub Desktop.
Save ybhwang/def320ab03bb0fcc037b8a7a94ca08f0 to your computer and use it in GitHub Desktop.

nvm allows you to quickly install and use different versions of node via the command line.

curl

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

wget

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

Edit ~/.zshrc

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

Source ~/.zshrc

source ~/.zshrc

List

Installed

nvm ls

Available to Install

nvm ls-remote

Version

Option -reinstall-packages-from=[VERSION] [-latest-npm]

Long Term Support

nvm install --lts
nvm install --lts=[VERSION]

Current

nvm install-latest-npm
nvm alias default [VERSION]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment