From b05640fc00d01d1793912007b9d77f49918eff35 Mon Sep 17 00:00:00 2001 From: AnthonyAxenov Date: Sat, 8 Jan 2022 14:40:30 +0800 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BE=D1=80=D1=80=D0=B5=D0=BA=D1=82?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=BA=D0=B0=20nvm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install/997-nodejs.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/install/997-nodejs.sh b/install/997-nodejs.sh index ce6e357..f3f9a56 100755 --- a/install/997-nodejs.sh +++ b/install/997-nodejs.sh @@ -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