Skip to content

Instantly share code, notes, and snippets.

@gnanet
Created January 16, 2024 18:27
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 gnanet/5db1cca041f9f763f5c44e10fe2067de to your computer and use it in GitHub Desktop.
Save gnanet/5db1cca041f9f763f5c44e10fe2067de to your computer and use it in GitHub Desktop.
install latest nvm.sh dynamically always the latest
#!/bin/bash
NVM_LATEST=$(curl https://api.github.com/repos/nvm-sh/nvm/releases/latest -s | grep "tag_name"| awk '{print substr($2, 2, length($2)-3) }')
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_LATEST}/install.sh | bash
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
nvm install --lts node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment