Loading Depth Study
Preparing your workspace
A lock file records the exact dependency versions and resolved dependency information used by an installation.
package.json may allow a range of compatible versions, but a lock file records the exact versions selected during installation along with dependency resolution details. This helps different developers, CI systems, and deployment environments install a consistent dependency tree. Teams normally commit the lock file appropriate for their package manager.
Two developers cloning the same project can use the committed lock file to install the same resolved dependency versions instead of independently resolving different versions.
package.json
↓ allowed version ranges
package-lock.json
↓ exact resolved dependency tree
InstallationThe lock file helps keep dependency resolution consistent across environments.