What the heck is NVM
Recently I was working on an old project and added a new feature and pushed the code like a boss. Soon my happiness ended as my fellow collaborator called me and said your code is not working. I was stunned and asked him to restart his system (typical IT trick), reinstall the node_modules… We tried everything but nothing worked.
Few hours of digging, we found that our Node versions are different. I updated my Node to the latest LTS and found that one of the dependency is using a deprecated API of Node. I updated that dependency made some minor changes and boom it worked.
What’s the solution?
Magically I met NVM and it saved my life from dealing with different Node versions.
NVM (Node Version Manager) is a utility tool which helps to switch between different Node versions on the fly.
How does it work?
It downloads different versions and saves it locally on demand. And points the system to that specific folder. Think it like a pointer which contains the address (location in the file system) of those Node binaries, and NVM just changes the pointer value in turn pointing to a different Node version.
How to use NVM
After installing NVM just run nvm use v[VERSION]
nvm use v8
To get the list of node versions currently installed use nvm list
Conclusion
Pahale istemal kare fir vishwas kare. :)