From 9571ade0c1d25d9f7160c9fcdf595726754be5e0 Mon Sep 17 00:00:00 2001 From: ray Date: Thu, 19 Mar 2020 21:44:26 +0000 Subject: [PATCH] install node.js and yarn --- config.sh | 3 +++ dev-setup/node.sh | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100755 dev-setup/node.sh diff --git a/config.sh b/config.sh index 388714d..7db5906 100644 --- a/config.sh +++ b/config.sh @@ -1,2 +1,5 @@ export _url="hugo-skeleton.home" export _user='ray' + +export _node_version=v12.16.1 +export _node_distro=linux-x64 diff --git a/dev-setup/node.sh b/dev-setup/node.sh new file mode 100755 index 0000000..fec5566 --- /dev/null +++ b/dev-setup/node.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +set -e + +if command -v apt-get ; then + apt-get -y install gnupg +else + echo "Error - no package installer found." + exit 1 +fi + +cd /tmp +wget https://nodejs.org/dist/"$_node_version"/node-"$_node_version"-"$_node_distro".tar.xz +sudo mkdir -p /usr/local/lib/nodejs +tar -xJvf node-"$_node_version"-"$_node_distro".tar.xz -C /usr/local/lib/nodejs + +echo "PATH=/usr/local/lib/nodejs/node-$_node_version-$_node_distro/bin:$PATH" >> /home/"$_user"/.profile + +curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - +echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list +apt-get update && sudo apt-get -y install yarn