Skip to content

Commit 0d4d808

Browse files
attempt to speed up nodejs installing
1 parent 3d19814 commit 0d4d808

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/run.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,20 @@ echo "$msg1"
4343

4444
installNodejs() {
4545
echo "$msg2"
46-
sudo apt update -qq && sudo apt install -y nodejs npm > /dev/null 2>&1
47-
if [ $? -ne 0 ]; then
46+
sudo apt-get remove -y nodejs npm || true
47+
sudo apt-get update -qq
48+
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
49+
sudo apt-get install -y nodejs
50+
if ! command -v node > /dev/null; then
4851
local ERROR_MESSAGE=$(ErrorMessage "run.sh" "0205")
4952
echo "$ERROR_MESSAGE"
50-
sudo apt update
51-
sudo apt install -y nodejs npm
53+
sudo apt update -qq && sudo apt install -y nodejs npm > /dev/null 2>&1
54+
if [ $? -ne 0 ]; then
55+
local ERROR_MESSAGE=$(ErrorMessage "run.sh" "0205")
56+
echo "$ERROR_MESSAGE"
57+
sudo apt update
58+
sudo apt install -y nodejs npm
59+
fi
5260
fi
5361
echo "$msg3"
5462
node --version

0 commit comments

Comments
 (0)