Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install Node.js via NVM automatically using the latest LTS
# https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-18-04
curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh -o install_nvm.sh
bash install_nvm.sh
{ cat << 'EOT'; cat << EOF; } >> ~/.$(echo $SHELL | grep -o '[^/]*$')rc
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
EOT
EOF
source ~/.$(echo $SHELL | grep -o '[^/]*$')rc
nvm install $(nvm ls-remote | grep "Latest LTS" | tail -1 | grep -oP '(\d+\.?){3}')
@defaye

This comment has been minimized.

Copy link
Owner Author

defaye commented Jun 2, 2020

To run this command in one line:

curl -s https://gist.githubusercontent.com/defaye/58921f409536948b6b7fa1e3ea777303/raw/c6a8e11b955ace9b9433ec165e64462ede673800/install_nvm_node.sh | sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.