Junior — Middle
What is the main function of the package-lock.json file in a Node.js project?
sobes.tech AI
Answer from AI
The package-lock.json file in a Node.js project records the exact versions of all installed dependencies and their nested dependencies. Its main function is to ensure deterministic installs, so that running npm install on different machines or at different times results in the same set of libraries. This helps avoid version incompatibility issues and guarantees environment stability.