Skip to content

Instantly share code, notes, and snippets.

@variadico
Created April 4, 2021 02:25
Show Gist options
  • Save variadico/b64641d8dcaf00e1b877ee4c89fc6204 to your computer and use it in GitHub Desktop.
Save variadico/b64641d8dcaf00e1b877ee4c89fc6204 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -euo pipefail
version=${1:-}
if [[ -z "$version" ]]; then
echo "missing version"
echo "usage: install-node.sh <version>"
exit 1
fi
dl="/tmp/node.tar.gz"
url="https://nodejs.org/dist/v${version}/node-v${version}-linux-x64.tar.gz"
set -x
curl -L -o "$dl" "$url"
sudo rm -rf /usr/local/node
sudo tar -C /usr/local -xzf "$dl"
sudo mv "/usr/local/node-v${version}-linux-x64" /usr/local/node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment