A lockfile only earns its keep if it is committed, respected in CI and regenerated on purpose. Do those three things and your builds are reproducible; skip any one and the lockfile is decoration.
Most build breakage I get called into has the same root cause: a lockfile that exists but is not enforced. Someone ran the everyday install command locally, it quietly updated the lockfile to whatever resolved that afternoon, and CI installed something different again because it never read the lockfile at all. This is the reference for stopping that — the exact commands that install strictly from the lock, the flags that fail CI on drift, and the merge-conflict resolution that does not silently unpin everything you worked to pin.
The one rule underneath all three tools
Every ecosystem has two distinct operations that people conflate. One resolves your declared dependencies into a concrete set of versions and writes that set to the lockfile. The other installs exactly what the lockfile already says, touching nothing. Local development blurs them because the friendly default does both at once. CI must not. In CI you want the install operation and only the install operation, so that a stale or hand-edited lockfile is a loud failure rather than a silent resolve.
Free · 4 minutes
Do you actually know what you are running — and what it is about to cost you?
Fourteen questions on the systems you depend on, the ones nobody owns, and the support dates that turn a routine upgrade into a forced re-platform. Banded finding on screen, full sheet by email.
Commit the lockfile for anything you deploy — package-lock.json, poetry.lock, uv.lock. The one long-standing exception is a library published for others to consume, where you deliberately do not pin your consumers’ transitive tree. Everything that ships as a running service commits the lock.
The commands that install from the lock and nothing else
These are the install-from-lock and drift-check commands for each tool. The comments matter as much as the commands.
# --- npm ---
# Install strictly from package-lock.json. Errors if package.json and the
# lockfile disagree; wipes node_modules first; verifies integrity hashes;
# never writes to the lockfile. This is the CI install command.
npm ci
# Regenerate the lockfile deliberately, without installing anything, after
# you have changed package.json on purpose:
npm install --package-lock-only
# --- Poetry (2.0+) ---
# Fail if poetry.lock is out of sync with pyproject.toml. Run this FIRST in CI;
# it changes nothing and exits non-zero on drift.
poetry check --lock
# Install exactly what the lock pins and remove anything not in it.
# (Poetry 1.x: poetry install --sync, now deprecated in favour of the below.)
poetry sync --no-root
# Regenerate the lockfile on purpose, without touching the environment:
poetry lock
# --- uv ---
# Install from uv.lock without resolving or updating it. Fastest; assumes the
# lock is already correct.
uv sync --frozen
# Assert the lock is up to date with pyproject.toml, then sync. Errors instead
# of updating if it is stale. This is the stricter CI choice.
uv sync --locked
# Check-only equivalent, changes nothing:
uv lock --check
# Regenerate the lockfile deliberately:
uv lock
The distinction between uv’s two modes is worth internalising. --frozen trusts the lockfile blindly and installs from it; --locked first verifies the lockfile matches pyproject.toml and fails if it does not. Use --locked in CI when you want drift to break the build, and --frozen in a container image build where you have already validated the lock upstream and just want the fast path. If uv is new to your Python toolchain, it pairs with the same reasoning I set out in installing Python CLI tools the sane way.
How each one detects drift
“Drift” means the declared manifest and the lockfile no longer agree — usually because someone edited package.json or pyproject.toml and forgot to regenerate the lock. Each tool surfaces it differently:
- npm folds detection into the install:
npm ciaborts with a non-zero exit ifpackage.jsonandpackage-lock.jsonare out of sync, and re-verifies every package’sintegrityhash from the lock as it unpacks. - Poetry separates it out:
poetry check --lockcompares the content hash embedded inpoetry.lockagainstpyproject.tomland exits non-zero on mismatch, without installing. - uv gives you both shapes: the
--lockedflag onuv syncfor detect-then-install, oruv lock --checkfor a pure check step.
Put the check-only variant early in the pipeline. A failed drift check in the first thirty seconds is far cheaper than a mysterious version difference discovered in a deploy.
Regenerate deliberately, never as a side effect
Regenerating a lockfile is a decision, not an accident. Do it when you have changed a declared dependency, when you are consciously taking upgrades, or when a security advisory forces a bump. Do it with the dedicated command — npm install --package-lock-only, poetry lock, uv lock — and commit the resulting diff as its own reviewable change. What you never want is the lockfile changing as a by-product of someone running a plain install, because then the diff shows up under unrelated work and nobody reviews it.
Which brings me to reviewing the diff. A lockfile diff in a pull request is not noise to be waved through. It is your dependency supply chain changing in front of you — the same information a bill of materials is meant to capture. Read what versions moved, whether transitive packages you have never heard of appeared, and whether the integrity hashes changed for packages whose version did not. A version staying the same while its hash changes is a signal worth stopping for.
Merge conflicts without unpinning everything
The most damaging lockfile mistake is resolving a merge conflict by regenerating from scratch. Two branches both touched the lockfile, Git shows a wall of conflict markers, and the tempting fix is to delete the lockfile and run a fresh resolve. That silently re-resolves every dependency in the project to today’s latest compatible versions — you have thrown away every pin, not just the two that actually conflicted, and the diff is too large for anyone to review honestly.
The disciplined resolution is to take one side of the manifest cleanly — reconcile package.json or pyproject.toml by hand — then regenerate only the lockfile from that reconciled manifest and inspect the diff. For npm, resolve package.json, then npm install --package-lock-only. For Poetry, resolve pyproject.toml, then poetry lock. For uv, resolve pyproject.toml, then uv lock. The lockfile is a generated artefact; treat the manifest as the source of truth in a conflict and let the tool rebuild the lock from it.
Get this right and reproducibility stops being a hope and becomes a property of the pipeline. The commands are trivial. The discipline of always using the frozen install in CI, checking for drift first, and never regenerating by accident is the whole game.
Free interactive tool
Website compliance checklist
What your site has to do, based on what it actually does
Answer as much or as little as you like — the list builds as you go. Nothing is stored against your name and no email is required.
Everything that applies
Ordered by what to do first: legal requirements you can close quickly, then larger pieces of work, then what is expected rather than required. Not exhaustive, and not a legal audit.
Dated PDF, yours to keep or circulate.
Most technology problems are not technology problems. They are control problems.
The systems exist. The investment has been made. The question is whether leadership can understand, direct, evidence, and sustain what those systems produce. Find out where control exists — and where it only appears to.