Integrating direnv with nvm

2019-01-30 17:12:00 +0000

To integrate direnv with nvm, add the following to ~/.direnvrc:

use_nodejs() {
    NODE_VERSION="$1"

    type nvm >/dev/null 2>&1 || . ~/.nvm/nvm.sh
    nvm use "$NODE_VERSION"
}

Then add (e.g.) the following to your project’s .envrc:

use nodejs 10.15.0