Created
December 9, 2019 19:14
-
-
Save dansalias/befe9f1e6bbcb17bc2a37bd517f8fc03 to your computer and use it in GitHub Desktop.
Switch node versions without nvm
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
# node-switch alias | |
alias ns=$HOME/scripts/node-switch.sh | |
# switch node version based on .nvmrc | |
default_node_version=12.13.1 | |
chpwd() { | |
if [[ -f .nvmrc && -r .nvmrc ]]; then | |
ns switch "$(< .nvmrc)" | |
elif [[ $(node --version) != v$default_node_version ]]; then | |
ns switch $default_node_version | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment