From 9cfd4044f1b0973683c7ac69d3202b4c12914fda Mon Sep 17 00:00:00 2001 From: Ryan Bakkes Date: Sun, 28 Aug 2022 23:26:40 +0200 Subject: [PATCH] install node through nvm --- src/applications/node.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/applications/node.sh b/src/applications/node.sh index 57267cd..631ffdf 100644 --- a/src/applications/node.sh +++ b/src/applications/node.sh @@ -1,3 +1,16 @@ -curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - -./../applications/gcc.sh -sudo apt-get install -y nodejs \ No newline at end of file +# get nvm package +wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash + +# export nvm to env table +if [[ $(which zsh) == "/usr/bin/zsh" ]]; then + echo 'export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"' >> ~/.zshrc + echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.zshrc + source ~/.zshrc +else + echo 'export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"' >> ~/.bashrc + echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc + source ~/.bashrc +fi + +# install latest version of node +nvm install node \ No newline at end of file