Skip to content

Instantly share code, notes, and snippets.

@beosro
Forked from ybhwang/nvm.md
Created January 12, 2023 23:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beosro/c5a6f050850eb250aca2032c34e5f8d4 to your computer and use it in GitHub Desktop.
Save beosro/c5a6f050850eb250aca2032c34e5f8d4 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