Last active
August 29, 2015 14:07
-
-
Save xcambar/2f88b912b7d40fe605c5 to your computer and use it in GitHub Desktop.
Install Node 0.10.x with NVM
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
#!/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