Skip to content

Instantly share code, notes, and snippets.

@hlobil
Forked from madhums/nodejs-install-update.sh
Last active December 16, 2015 09:19
Show Gist options
  • Save hlobil/5412569 to your computer and use it in GitHub Desktop.
Save hlobil/5412569 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Usage:
# curl https://raw.github.com/gist/3791075 | sh -s 0.8.10
# This script will simply install/update node.js to the version you specify.
# It will be installed/updated to $HOME/local/node
NODEJS=v$1
cd /tmp
wget http://nodejs.org/dist/$NODEJS/node-$NODEJS.tar.gz
tar -xzvf node-$NODEJS.tar.gz
cd node-$NODEJS
make clean
./configure --prefix=$HOME/local/node
make
make install
# install/update npm
curl -k https://npmjs.org/install.sh | clean=yes sh
# Put the below in your ~/.bash_profile
# function update-node {
# version=$1
# curl https://raw.github.com/gist/3791075 | sh -s $version
# }
# Now you can simply run update-node 0.8.10 !
# Oh and btw, it will install node to ~/local/node directory.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment