Files
easyzsh/install_nvm.sh
T
Frank Qing 76395923ce fix(install): make setup failures explicit and atomic
Installer pipelines masked dependency and download failures, causing
false success messages and unsafe config replacement.

Atomic updates and current upstream installers keep failures visible.
2026-07-15 00:16:33 +08:00

26 lines
798 B
Bash
Executable File

#!/bin/bash
set -euo pipefail
NVM_VERSION="v0.40.4"
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
# 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 -fsSL "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" | bash
# Load nvm for the remainder of this script
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
command -v nvm &> /dev/null
fi
# Install the latest LTS version of Node.js
nvm install --lts
# Apply the nvm zsh configuration patch
curl -fsSL https://git.miomio.moe/mio/easyzsh/raw/branch/master/patch.sh | bash -s -- nvm