From 906ecf16da8a98d3afd8fdd483b08e37929fcd79 Mon Sep 17 00:00:00 2001 From: Valentin Date: Fri, 23 Feb 2024 19:19:36 +0100 Subject: [PATCH] install npm 4 --- install.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 4ccc638..e00146f 100644 --- a/install.sh +++ b/install.sh @@ -170,8 +170,11 @@ fi echo -e "${PURPLE}${BOLD}Install NPM ? (y/n) ${RESET}" read answer if [[ "$answer" == "y" ]]; then + if [[ -z "$username" ]]; then + username = $(getent passwd 1000 | cut -d: -f1) + fi su -c 'curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash &&\ - export NVM_DIR="/home/${username}/.nvm" &&\ + export NVM_DIR="$HOME/.nvm" &&\ [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" &&\ [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" &&\ nvm install v18' $username