Merge pull request #1709 from gokaygurcan/improve-nvm-installer

[Linux, macOS] Improve nvm installer
This commit is contained in:
Maxim Lobanov
2020-10-06 14:17:13 +03:00
committed by GitHub
2 changed files with 6 additions and 4 deletions

View File

@@ -7,7 +7,8 @@
export NVM_DIR="/etc/skel/.nvm" export NVM_DIR="/etc/skel/.nvm"
mkdir $NVM_DIR mkdir $NVM_DIR
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash VERSION=$(curl -s https://api.github.com/repos/nvm-sh/nvm/releases/latest | jq -r '.tag_name')
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$VERSION/install.sh | bash
echo 'export NVM_DIR=$HOME/.nvm' | tee -a /etc/skel/.bash_profile echo 'export NVM_DIR=$HOME/.nvm' | tee -a /etc/skel/.bash_profile
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' | tee -a /etc/skel/.bash_profile echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' | tee -a /etc/skel/.bash_profile
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

View File

@@ -6,7 +6,8 @@
########################################################################### ###########################################################################
source ~/utils/utils.sh source ~/utils/utils.sh
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.35.3/install.sh | bash VERSION=$(curl -s https://api.github.com/repos/nvm-sh/nvm/releases/latest | jq -r '.tag_name')
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$VERSION/install.sh | bash
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
. ~/.bashrc . ~/.bashrc
@@ -23,13 +24,13 @@ if [ $? -eq 0 ]; then
nvm alias node12 lts/erbium nvm alias node12 lts/erbium
nvm alias node13 v13 nvm alias node13 v13
nvm alias node14 v14 nvm alias node14 v14
if is_Catalina || is_BigSur; then if is_Catalina || is_BigSur; then
# set system node as default # set system node as default
nvm alias default system nvm alias default system
fi fi
else else
echo error echo error
fi fi
echo "Node version manager has been installed successfully" echo "Node version manager has been installed successfully"