install node.js and yarn

This commit is contained in:
Ray Elliott 2020-03-19 21:44:26 +00:00
parent 46124691f4
commit 9571ade0c1
2 changed files with 24 additions and 0 deletions

View File

@ -1,2 +1,5 @@
export _url="hugo-skeleton.home"
export _user='ray'
export _node_version=v12.16.1
export _node_distro=linux-x64

21
dev-setup/node.sh Executable file
View File

@ -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