Skip to content

Instantly share code, notes, and snippets.

@GnsP
Created July 15, 2017 15:08
Show Gist options
  • Save GnsP/43012b8ea66ab028a45d11d805624a8a to your computer and use it in GitHub Desktop.
Save GnsP/43012b8ea66ab028a45d11d805624a8a to your computer and use it in GitHub Desktop.
# create a local bin
mkdir -p ~/bin
# link python2 as default python in local bin and export the path (must for Ubuntu 16.04)
ln -s ${which python2} ~/bin/python
export PATH=~/bin:$PATH
# create node_env directory and setup the virtualenv there, activate that
mkdir -p ~/node_env
`which python2` -m virtualenv ~/node_env
source ~/node_env/bin/activate
#download latest NodeJS source, go the the source folder
curl http://nodejs.org/dist/node-latest.tar.gz | tar xvz
cd node-v*
# configure, build and install, currently set to build on 64 cores for a faster build
./configure --prefix=$VIRTUAL_ENV
make install -j `nproc`
#deactivate the virtualenv
deactivate
# whenever you need to use the latest node, simply activate the ~/node_env and it'll work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment