Корректировка nvm

This commit is contained in:
Anthony Axenov 2022-01-08 14:40:30 +08:00
parent a5bf6bac4c
commit b05640fc00
Signed by: anthony
GPG Key ID: EA9EC32FF7CCD4EC

View File

@ -1,20 +1,28 @@
#!/bin/bash
. "../src/01-common.sh" || exit 5
title "Installing nodejs..."
echo
echo "==============================================="
echo "Installing nodejs..."
echo "==============================================="
echo
# apti nodejs npm
installed() {
command -v "$1" >/dev/null 2>&1
}
# sudo apt install -y --autoremove nodejs npm
if !installed "nvm"; then
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
fi
if [ $(nvm current) == 'system' ]; then
warning "You already have node installed - removing to install actual version"
echo "WARNING: You already have node installed - removing to install actual version"
sudo apt remove -y --autoremove nodejs npm
else
nvm install-latest-npm
fi
nvm install node
nvm use node
installed "node" && success "nodejs installed! $(nvm current)"
installed "npm" && success "npm installed! $(nvm current)"
installed "node" && nvm current
nvm ls