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