Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
usage of .nvmrc
# To use this, add .nvmrc with contents of 'N.N.N' to your project. e.g. 0.12.7
# Add the following to the end of .bash_profile or .bashrc
# if directory is changed
# if `.nvmrc` is found execute `nvm use`
# if `package.json` is round execute `nvm use default`
enter_directory() {
if [ "$PWD" != "$PREV_PWD" ]; then
if [ -e ".nvmrc" ]; then
nvm use;
elif [ -e "package.json" ]; then
nvm use default
export PROMPT_COMMAND="$PROMP_COMMAND enter_directory;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment