Skip to content

Commit c92f9d5

Browse files
authored
Check and remove Node.js if version is not 22
Remove existing Node.js installation if version is not 22.
1 parent c7fffd8 commit c92f9d5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

ct/nginxproxymanager.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@ function update_script() {
2727
msg_error "No ${APP} Installation Found!"
2828
exit
2929
fi
30+
31+
if command -v node &> /dev/null; then
32+
CURRENT_NODE_VERSION=$(node --version | cut -d'v' -f2 | cut -d'.' -f1)
33+
if [[ "$CURRENT_NODE_VERSION" != "22" ]]; then
34+
systemctl stop openresty
35+
apt-get purge -y nodejs npm
36+
apt-get autoremove -y
37+
rm -rf /usr/local/bin/node /usr/local/bin/npm
38+
rm -rf /usr/local/lib/node_modules
39+
rm -rf ~/.npm
40+
rm -rf /root/.npm
41+
fi
42+
fi
3043

3144
NODE_VERSION="22" NODE_MODULE="yarn" setup_nodejs
3245
export NODE_OPTIONS="--openssl-legacy-provider"

0 commit comments

Comments
 (0)