Created
May 26, 2020 12:41
-
-
Save defaye/58921f409536948b6b7fa1e3ea777303 to your computer and use it in GitHub Desktop.
Install Node.js via NVM automatically using the latest LTS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To run this command in one line: