Search code examples
javascriptnode.jsshellnvm

run `nvm use` automatically every time there's a .nvmrc file on the directory


How to configure my shell so that nvm use run automatically every time there's a .nvmrc file on the directory and use the latest version or a global config when there's no .nvmrc file?


Solution

  • I just found out about Automatic Version Switching for Node.js https://github.com/wbyoung/avn, you can use that.

    npm install -g avn avn-nvm avn-n
    avn setup
    

    You can also follow this thread https://github.com/creationix/nvm/issues/110