Last active
January 5, 2026 11:25
-
-
Save aaronedev/42a1b853a39c89a716041214221e1ba7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| export NVM_DIR="$HOME/.nvm" | |
| if [ ! -s "$NVM_DIR/nvm.sh" ]; then | |
| curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash | |
| fi | |
| . "$NVM_DIR/nvm.sh" | |
| touch "$HOME/.bashrc" "$HOME/.bash_profile" | |
| grep -q '\. ~/.bashrc' "$HOME/.bash_profile" || printf '\n[ -f ~/.bashrc ] && . ~/.bashrc\n' >>"$HOME/.bash_profile" | |
| grep -q 'export NVM_DIR="$HOME/.nvm"' "$HOME/.bashrc" || cat >>"$HOME/.bashrc" <<'EOF' | |
| export NVM_DIR="$HOME/.nvm" | |
| [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" | |
| EOF | |
| # repo-driven if .nvmrc exists; otherwise use the same LTS you already have | |
| if [ -f .nvmrc ]; then | |
| nvm install --no-progress | |
| nvm use | |
| else | |
| nvm install lts/krypton --no-progress | |
| nvm use lts/krypton | |
| fi | |
| node -v | |
| npm -v | |
| npm ci |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment