Created
April 7, 2015 19:50
-
-
Save cmmartin/cd2cdb2858e955c5f87d to your computer and use it in GitHub Desktop.
Upgrade node.js using n
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
#!/bin/bash | |
# Updates your version of node.js using the version control system "n" | |
# @param a version (default is latest stable) | |
# https://github.com/tj/n | |
sudo npm cache clean -f | |
sudo npm install -g n | |
version=`node -v` | |
if [ $# -gt 0 ]; then | |
echo "upgrading node from $version to v$1" | |
sudo n $1 | |
else | |
echo "upgrading node from $version to latest stable" | |
sudo n stable | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment