Skip to content

Instantly share code, notes, and snippets.

@pterk
Last active March 3, 2016 21:25
Show Gist options
  • Save pterk/59016a80689d72f0e610 to your computer and use it in GitHub Desktop.
Save pterk/59016a80689d72f0e610 to your computer and use it in GitHub Desktop.
#!/bin/bash
VERSION="v5.7.1"
ARCH="linux-x64"
ARCHIVE="node-${VERSION}-${ARCH}.tar.gz"
URL="https://nodejs.org/dist/${VERSION}/${ARCHIVE}"
if [ -z "${VIRTUAL_ENV}" ]; then
echo "Please activate a virtualenv first";
exit
fi
#echo $URL
#exit
pushd /tmp/
mkdir -p _node && cd $_ && wget $URL -O - | tar zxf - --strip-components=1 # downloads and unzips the content to _node
cp -r ./lib/node_modules/ ${VIRTUAL_ENV}/lib/ # copy the node modules folder to the /lib/ folder
cp -r ./include/node ${VIRTUAL_ENV}/include/ # copy the /include/node folder to /usr/local/include folder
cp bin/node ${VIRTUAL_ENV}/bin/ # copy node to the bin folder
ln -s "${VIRTUAL_ENV}/lib/node_modules/npm/bin/npm-cli.js" ${VIRTUAL_ENV}/bin/npm ## making the symbolic link to npm
popd
@pterk
Copy link
Author

pterk commented Nov 13, 2015

Installs a pre-build node-js in a virtual environment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment