Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Install Node.js via NVM automatically using the latest LTS
curl -sL -o
{ cat << 'EOT'; cat << EOF; } >> ~/.$(echo $SHELL | grep -o '[^/]*$')rc
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/" ] && \. "$NVM_DIR/" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
source ~/.$(echo $SHELL | grep -o '[^/]*$')rc
nvm install $(nvm ls-remote | grep "Latest LTS" | tail -1 | grep -oP '(\d+\.?){3}')

This comment has been minimized.

Copy link
Owner Author

@defaye defaye commented Jun 2, 2020

To run this command in one line:

curl -s | sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment