Skip to content

Instantly share code, notes, and snippets.



Last active Jan 28, 2020
What would you like to do?
Find and install latest node from source on Ubuntu.
echo "Finding latest version."
VERSION=`curl -s | awk '/node-v/ {print $2}' | head -1 | sed s/node-v// | sed s/-/\ / | awk '{print $1}'`
echo "Preparing to install node-v$VERSION"
echo "GET" $url
curl $url | tar -zxf -
cd "node-v"$VERSION
# Doing Deps
echo "Installing deps."
# For some reason everything after apt-get requires explicit &&
apt-get -y install build-essential openssl libssl-dev pkg-config &&
echo "Finished deps." &&
# Time to Install
./configure &&
make &&
make install &&
cd .. &&
rm -rf node-v$VERSION &&
node --version &&
curl -s | bash

This comment has been minimized.

Copy link

@jhs jhs commented May 24, 2014

At line 15, you could add set -e which will exit with an error if any command fails (returns nonzero).

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