Files
easyzsh/install_nvm.sh

28 lines
985 B
Bash
Executable File

#!/bin/bash
# Save the original working directory
ORIGINAL_DIR="$(pwd)"
# Install nvm (Node Version Manager) if it is not already installed
if command -v nvm &> /dev/null; then
echo -e "nvm is already installed\n"
else
echo -e "Installing nvm (Node Version Manager)\n"
# Using the official install script (https://github.com/nvm-sh/nvm)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
# Load nvm for the remainder of this script
export NVM_DIR="${XDG_CONFIG_HOME:-$HOME/.nvm}"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
fi
# OPTIONAL: Install the latest LTS version of Node.js
# Uncomment the following line if you would like to automatically install it
nvm install --lts
# Apply the "basic" zsh configuration patch (downloads zshrc/basic.zsh to ~/.config/zshrc/basic.zsh)
curl -s https://git.miomio.moe/mio/easyzsh/raw/branch/master/patch.sh | bash -s nvm
# Restore original working directory
cd "$ORIGINAL_DIR"