Develop: Update install-nodejs.sh script

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer 2023-09-11 11:09:15 +02:00
parent 304c8e3ae6
commit 18efd74aab

View file

@ -15,21 +15,27 @@ set -e
. /etc/os-release . /etc/os-release
if [[ $VERSION_CODENAME == "lunar" ]]; then # NodeJS version.
NODE_MAJOR=20
if [[ $VERSION_CODENAME == "mantic" ]]; then
echo "Installing NodeJS and NPM distribution packages..." echo "Installing NodeJS and NPM distribution packages..."
apt-get update && apt-get -qq install nodejs npm apt-get update && apt-get -qq install nodejs npm
else else
SETUP_URL="https://deb.nodesource.com/setup_18.x" # Create /etc/apt/keyrings/nodesource.gpg
mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
echo "Fetching packages from \"$SETUP_URL\"..." # Create /etc/apt/sources.list.d/nodesource.list
wget --inet4-only -c -qO- $SETUP_URL | bash - echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
echo "Installing NodeJS, NPM, and TestCafe..." echo "Installing NodeJS and NPM from deb.nodesource.com..."
apt-get update && apt-get -qq install nodejs apt-get update && apt-get -qq install nodejs
fi fi
npm install --unsafe-perm=true --allow-root -g npm testcafe echo "Installing TestCafe..."
npm config set cache ~/.cache/npm npm config set cache ~/.cache/npm
npm install --unsafe-perm=true --allow-root -g npm testcafe
npm update --unsafe-perm=true --allow-root -g npm update --unsafe-perm=true --allow-root -g
echo "Done." echo "Done."