# ░█▀█░█░█░█▄█ # ░█░█░▀▄▀░█░█ # ░▀░▀░░▀░░▀░▀ # Node Version Manager configuration - Simplified & Robust # NVM directory export NVM_DIR="${HOME}/.nvm" # Add claude-code's specific Node version to PATH # This ensures claude-code always works without complexity if [[ -d "$HOME/.nvm/versions/node/v22.16.0/bin" ]]; then export PATH="$HOME/.nvm/versions/node/v22.16.0/bin:$PATH" fi # Lazy load nvm for better shell startup performance nvm() { # Remove this function unset -f nvm # Load the real nvm [ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh" [ -s "$NVM_DIR/bash_completion" ] && source "$NVM_DIR/bash_completion" # Call nvm with the original arguments nvm "$@" } # Aliases for when you need to use nvm alias nvm-load='unset -f nvm; [ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh"' alias nvm-claude='nvm use 22.16.0' alias node-homebrew='/opt/homebrew/bin/node' alias npm-homebrew='/opt/homebrew/bin/npm' # Quick check if we're in a project with .nvmrc check_nvmrc() { if [[ -f .nvmrc ]] && [[ -z "${NVM_BIN}" ]]; then echo "📦 .nvmrc detected. Run 'nvm-load && nvm use' to switch Node version" fi } # Hook to check for .nvmrc on directory change if [[ -n "$ZSH_VERSION" ]]; then autoload -U add-zsh-hook add-zsh-hook chpwd check_nvmrc # Check current directory on shell start check_nvmrc fi