Skip to content

Commit 6a38139

Browse files
authored
Merge pull request #26 from MarkChenYutian/issue25
added nodejs installer
2 parents 5567e7b + 85be4b1 commit 6a38139

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

installers/node/installer.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh
2+
3+
YUM_CMD=$(which yum) # yum package manager for RHEL & CentOS
4+
DNF_CMD=$(which dnf) # dnf package manager for new RHEL & CentOS
5+
APT_GET_CMD=$(which apt-get) # apt package manager for Ubuntu & other Debian based distributions
6+
APK_CMD=$(which apk) # apk package manager for Alpine
7+
8+
if [ ! -z $APT_GET_CMD ]; then
9+
if [ -n "$(uname -a | grep Ubuntu)" ]; then
10+
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
11+
sudo apt-get install -y nodejs
12+
else
13+
curl -sL https://deb.nodesource.com/setup_12.x | bash -
14+
sudo apt-get install -y nodejs
15+
fi
16+
elif [ ! -z $DNF_CMD ]; then
17+
sudo dnf install -y gcc-c++ make
18+
curl -sL https://rpm.nodesource.com/setup_12.x | sudo -E bash -
19+
sudo dnf install nodejs
20+
elif [ ! -z $YUM_CMD ]; then
21+
sudo yum install nodejs12
22+
elif [ 1 -z $APK_CMD ]; then
23+
sudo apk update
24+
sudo apk add nodejs
25+
else
26+
echo "Couldn't install package"
27+
exit 1;
28+
fi
29+
30+
node --version

0 commit comments

Comments
 (0)