From 89172ae5045de31ca52f9d22ce4af343e7b5c4f1 Mon Sep 17 00:00:00 2001 From: LPJon <46533576+LPJon@users.noreply.github.com> Date: Thu, 31 Aug 2023 02:16:36 -0500 Subject: [PATCH] Update install_netdata Added code to load NVM while still in the script --- install_netdata | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/install_netdata b/install_netdata index 9fe997a..5161825 100644 --- a/install_netdata +++ b/install_netdata @@ -29,7 +29,9 @@ function installnodeJS { fi elif [ "$usenvm" == "y" ]; then if [ -e "$HOME/.nvm" ];then - source $HOME/.bashrc + export NVM_DIR="$HOME/.nvm" + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm + [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion nvm install $nodeversion nvm use $nodeversion if [ "$(getsystemnodeversion)" != "v$nodeversion" ]; then @@ -39,7 +41,9 @@ function installnodeJS { if [ ! -e "$HOME/.nvm" ]; then yum -y install curl curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash - source $HOME/.bashrc + export NVM_DIR="$HOME/.nvm" + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm + [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion nvm install "$nodeversion" nvm use "$nodeversion" ln -sf /root/.nvm/versions/node/v"$nodeversion"/bin/node /usr/bin/node