nvm
The Node Version Manager or nvm
in short is a great tool.
We could debate the pros and cons of switching between multiple versions of NodeJS & NPM
versus dockerized containers for each specific version of NodeJS & NPM
but we won't tackle that here.
Instead we will focus on a common use case for those who are used to switching between multiple versions of NodeJS & NPM.
For those developers who are working across multiple nodejs projects, each with a different version ... you may end up running one of the projects using a version that wasn't meant for it. It can be tricky to remember and switch the version via nvm
per terminal window/tab. Luckily this can be automated by leveraging the metadata from .nvmrc
file in your projects.
My solution isn't a solution generic enough but I mixed together the previous suggestions from this thread with stackoverflow to add the following for mac/osx
in my ~/.bash_profile
and it worked well:
Now I can do:
Last updated