Some times code in production breaks, Product Managers and Testers often listen developers saying I have pushed these changes, but not reflected as expected. One of reason could be environment setup and installing dependencies. This often heard in legacies or projects that use older versions of dependencies. In this world of coffee ☕ lovers and developers, we cannot expect packages to be same ( especially open source ones ), lots of fixes and optimisations happen time to time. This is should not break our project in development or production environments.
What is the role of package-lock.json?
It serves as a record of locked dependency versions and provides a reliable means to reproduce the exact build environment.
In case of reinstalling packages too,
Never Delete package-lock.json if you take project seriously.
because if you delete package-lock and re-install, you are forcing the latest versions of all packages in the dependency tree, that might change entire application. Remove node_modules and install again.
Common question every developer gets atleast once - Should I push changes of package-lock.json to git? 🤔
This question generally raises when we plan to install a new package.
Communication with peers is key and by using git, it helps in collaboration too.If we don’t commit , Few things that might work for us, might not work for others or other environments.As the version of the package 📦 everyone else will get is different than what you are running locally.

