How to fix node version in a Web-App
How we can fix not version so that developer, CI/CD, production, everybody uses the same node version?
Step 1 — Add nodeVersionLock in package.json
we need to add preinstall and prestart scripts too.
Step 2 — Throw errors when undesired node-version found.
Step 3— AutoUpdate of Dockerfile & GitbHub YML
This step is optional and custom. it depends on your setup.
This is an example of my setup where I am calling the above script using pre-commit hooks.
So, we don’t need to update node-version on Docker or any kind of CI/CD yml files.
So, Next time, whenever you want to upgrade the node version, just update the nodeVersionLock field in package JSON and rest everything will be taken care of