Skip to content

Commit

Permalink
install-photobooth: install npm 9.6.7 if needed (#531)
Browse files Browse the repository at this point in the history
* install-photobooth: install npm 9.6.7 if needed

* install-photobooth: run apt-update before updating npm

* install-photobooth: purge npm aside nodejs if needed
  • Loading branch information
andi34 committed Jan 9, 2024
1 parent eecc1ec commit 6bc1e48
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion install-photobooth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,11 @@ update_nodejs() {
apt-get -qq purge -y libnode72
fi

if [ $(dpkg-query -W -f='${Status}' "npm" 2>/dev/null | grep -c "ok installed") -eq 1 ]; then
info "[Cleanup] Removing npm package"
apt-get -qq purge -y npm
fi

info "[Package] Installing latest Node.js v18"
apt-get -qq install -y ca-certificates curl gnupg
mkdir -p /etc/apt/keyrings
Expand Down Expand Up @@ -381,7 +386,8 @@ proof_npm() {
exit 1
else
warn "[WARN] npm needs to be updated!"
npm install npm@latest -g
apt-get -qq --only-upgrade install npm
npm install [email protected] -g
NPM_CHECKED=true
check_npm
fi
Expand All @@ -393,6 +399,7 @@ check_npm() {
info "[Info] npm available.".
else
info "[Info] npm not installed. Trying to install...".
apt-get -qq update
apt-get -qq install -y npm
fi
proof_npm
Expand Down

0 comments on commit 6bc1e48

Please sign in to comment.