Skip to content

Instantly share code, notes, and snippets.

@burkeholland
Forked from manekinekko/nodejs-setup.sh
Last active June 24, 2020 14:45
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 burkeholland/7045bc14bd9ce9cabefd74360d521524 to your computer and use it in GitHub Desktop.
Save burkeholland/7045bc14bd9ce9cabefd74360d521524 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
nvm_install_script=https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh
NVM_DIR="$HOME/.nvm"
NVM_NODE_VERSION=14
if [ ! -d "$HOME/.nvm" ]; then
echo "> Downloading NVM..."
curl -s -o- $nvm_install_script | bash >/dev/null 2>&1
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
nvm install --lts
fi
echo >&2 "> Node.js $(node --version) is ready to use."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment