New blog domain: kula.blog

It's still work in progress but new posts will be published on  https://kula.blog/ Thanks to 11ty base blog RSS is working from the start so it should be easy to add to your reader if you still use any :) If now then I hope you can sign up to the newsletter where I'll be publishing new posts and interesting articles to it from time to time. Please use  kula.blog  from now on.

NVM or N


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:
  1. https://github.com/tj/n
  2. https://github.com/creationix/nvm
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?


  1. Add all your dependencies to package.json
  2. Try using "n"
  3. Switch to "nvm" if you encounter any issues

Feedback? Are you using something else?

Comments

Popular posts from this blog

How to simulate slow connection (developer proxy in Node.js)

Safari Mobile CSS VW and VH units bug.