Skip to content
BENIBIX Learn

Lockfile vs Version Pinning

People think a lockfile and a pinned version are the same thing, and they are not. You pin a version by hand, in the list of packages you asked for. A lockfile is written by the tool. It holds the exact version of every package, even the ones your packages pulled in. So a project can ask for ranges and still get the same install each time.

Development🛠️ Editors & Tools

Lockfile

A file that lists the exact version of each package you use. You keep it in Git.

A lockfile is a file that lists the exact version of each package a project uses. That includes the packages those packages need. Your package manager writes it for you, like package-lock.json for npm. When someone else installs the project, they get the very same versions. You commit it to Git with the rest of your code.

Example
Lucy's app works on her laptop but breaks on the server. The server had no lockfile, so it installed newer versions.
Why it matters
It stops the classic bug where it works on one computer but not another. Every install gets the same code.
Full entry
Development🛠️ Editors & Tools

Version Pinning

Asking for one set version of a package. Then it does not change by itself.

Version pinning means asking for one exact version of a package, not a range. Writing react 18.3.1 is a pin. Writing ^18.3.1 is a range, so any later 18 version may come in. A pin means nothing changes until you change it. The cost is that fixes do not arrive by themselves, so you update the pins by hand or with a bot.

Example
A new version of a chart package broke Lucy's app overnight. She pins it to the last good version, and the app works again.
Why it matters
It keeps a working app working. A surprise update can no longer break it while you sleep.
Full entry

In one line

Lockfile
A file that lists the exact version of each package you use. You keep it in Git.
Version Pinning
Asking for one set version of a package. Then it does not change by itself.