This is another tool that make life easier as a developer, nvm - Node Version Manager.
By having a .nvmrc
-file in the root of your project you can define which version of node you are using for the project.
# content of .nvmrc
lts/18
The file above is saying that we are using the lts version 18 of node. With that file in our project we can execute following command:
nvm use
This will switch to the right version of node (depending on the .nvmrc
-file content), if the system do not have the correct node version installed it will make it easy for the user to install it.
It is pretty straightforward to install the nvm tool on your system, just following the installation instructions from nvm's GitHub page.
Now it will be a breeze to switch between node-versions in different projects.