I’ll introduce the npm module avn, which automatically switches Node.js versions - it’s very convenient. (Last updated: 2017/04/15)
npm install -g avn avn-nvm avn-n
$ avn setup
avn: profile setup complete (~/.zshrc)
avn: profile setup complete (~/.bash_profile)
avn: restart your terminal to start using avn
avn: configuration complete (~/.avnrc)
avn: installation complete
avn-n: installation complete
avn-nvm: installation complete
When you move to a directory that contains a .node-version file, avn automatically switches the Node.js version for you.
Sample .node-version
v12.16.2
$ cd ~/works/my_project
avn activated v12.16.2 (avn-nvm v12.16.2)
Since rvm, which nvm is based on, automatically switches Ruby versions, it’s nice to have similar behavior for Node.js.
That’s all from the Gemba, where I want nvm to automatically switch Node.js versions.