Skip to content

Instantly share code, notes, and snippets.

@xcambar
Last active August 29, 2015 14:07
Show Gist options
  • Save xcambar/2f88b912b7d40fe605c5 to your computer and use it in GitHub Desktop.
Save xcambar/2f88b912b7d40fe605c5 to your computer and use it in GitHub Desktop.
Install Node 0.10.x with NVM
#!/usr/bin/env sh
#
# You can change the version by passing the "VERSION" environment variable
# eg, env VERSION=0.10 sh node_nvm.sh
#
: ${VERSION:="stable"}
echo
echo Installing Node.js $VERSION with NVM
echo
curl https://raw.githubusercontent.com/creationix/nvm/v0.17.2/install.sh | bash
# Boilerplate to avoid the restart of ayour shell
if [ -z "$PROFILE" ]; then
if [ -f "$HOME/.bashrc" ]; then
PROFILE="$HOME/.bashrc"
elif [ -f "$HOME/.bash_profile" ]; then
PROFILE="$HOME/.bash_profile"
elif [ -f "$HOME/.zshrc" ]; then
PROFILE="$HOME/.zshrc"
elif [ -f "$HOME/.profile" ]; then
PROFILE="$HOME/.profile"
fi
fi
source $PROFILE
# Real stuff
nvm install $VERSION
nvm use $VERSION
nvm alias default $VERSION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment