Skip to content

Instantly share code, notes, and snippets.

@manekinekko
Created June 17, 2020 19:18
Show Gist options
  • Save manekinekko/b46ebff90a9e918cfc3b129adf5ff1ba to your computer and use it in GitHub Desktop.
Save manekinekko/b46ebff90a9e918cfc3b129adf5ff1ba 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=$NVM_DIR
# loads nvm
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# loads nvm bash_completion
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
echo "> Installing Node.js v$NVM_NODE_VERSION+..."
nvm install $NVM_NODE_VERSION >/dev/null 2>&1
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