I only added one small package—why did pnpm-lock.yaml change by hundreds of lines, and can I just delete it?
A generated file that records the exact resolved dependency versions and integrity hashes so every machine installs the same tree.·When teammates or CI clone a repo, package.json often lists version ranges while the lockfile pins every direct and nested package to an exact version. Update it through the package manager rather than editing or deleting it; it pins package versions, not your local Node.js version or environment variables.
Dependency installation says the lockfile does not match package.json. Do not hand-edit or delete the lockfile; update it with the project's current package manager, make sure no second lockfile from another manager was introduced, then rerun install and checks and report which packages changed.
With vs. without a lockfile: what do two machines install?
package.json
1"dependencies": { "date-kit": "^1.2.0" }
2// No lockfile committed: each install resolves ^1.2.0 again
Terminal
$ pnpm install
+ date-kit 1.2.4
✓ Local tests passed
Your machine (Monday)date-kit@1.2.4
Terminal
$ pnpm install
+ date-kit 1.3.0
✕ Unexpected format change in 1.3.0
CI / teammate (Friday)date-kit@1.3.0 (drifted)
Without a lockfile, ^1.2.0 can install 1.2.4 locally and 1.3.0 on CI days later.
Why lockfiles are generated by tools and committed to Git
The manifest allows ranges; the lockfile freezes exact versions: Entries like ^1.2.0 in package.json can resolve to newer minor versions later. The lockfile pins both direct dependencies and every nested sub-dependency to exact versions.
It stores integrity checks, not just version numbers: Lockfiles also record resolved package URLs and content hashes so the package manager can verify downloaded tarballs match what was recorded.
Large diffs are normal—never hand-edit them: Adding one library can bring in dozens of transitive packages. Let the project's package manager update the lockfile and commit it alongside package.json.
Quick checkChoose the best answer
You updated a dependency in package.json, and CI fails at pnpm install --frozen-lockfile saying the lockfile is out of date. What should happen next?