From time to time I go back to the problem of switching Node.js versions. Sometimes it's enough to just go to the node.js website and install a new version but if you have to switch versions between different projects all the time then you soon realize you need a tool for that.
I know of two such tools:
N has really nice UX and it's really intuitive to work with it. The problem arises if your different projects use different versions of global packages - you have to deal with it yourself.
The biggest advantage of NVM is that it switches global packages with the node version so you really get a clean slate with every version. The biggest problem I have with NVM is that it's UX is really bad and I found myself explaining the same things over and over again to my colleagues.
Because of the global packages, I found myself advising NVM to people last couple of years...
At the same time, I have learned the hard way that global dependencies are causing much more problems than the necessity of NVM. All projects that have used global dependencies were really hard to setup and those dependencies create a lot of problems in the long run.
It took me some time to add those to facts together. Basically switching global packages should not be necessary!
Even for complicated projects it's not really that hard to add all dependencies to packages.json. I've done that multiple times end the cost of slightly longer installation is nothing in comparison to how much easier it is to introduce a new person or to go back to the project after a couple of months.
So what's my advice?
- Add all your dependencies to package.json
- Try using "n"
- Switch to "nvm" if you encounter any issues
Feedback? Are you using something else?
Feedback or Comments?
Want to learn more?
Sign up to get a digest of my articles and interesting links via email every month.