Created
September 21, 2023 01:29
-
-
Save yunyuyuan/0a6d8af6d6b2a65d93d247ad834d144c to your computer and use it in GitHub Desktop.
nvm setup
This file contains 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
lazy_load_nvm() { | |
unset -f npm node nvm | |
export NVM_DIR=~/.nvm | |
[[ -s "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh" | |
[ -s "$NVM_DIR/bash_completion" ] && source "$NVM_DIR/bash_completion" | |
} | |
npm() { | |
lazy_load_nvm | |
npm $@ | |
} | |
node() { | |
lazy_load_nvm | |
node $@ | |
} | |
nvm() { | |
lazy_load_nvm | |
nvm $@ | |
} | |
if [ -f ".nvmrc" ]; then | |
nvm use > /dev/null | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment