The tools that install, version, and pin your dependencies — and produce the lockfile that guarantees the same code runs everywhere.
← Back to Client Sidepackage-lock.json, pnpm-lock.yaml, yarn.lock, bun.lockb) pins exact versions for reproducibility — always commit it.^1.2.3 = compatible upgrades, ~1.2.3 = patch only, 1.2.3 = exact.| Tool | Strengths | Trade-offs |
|---|---|---|
| npm | Bundled with Node.js; default everywhere. | Largest node_modules, slower than alternatives. |
| pnpm | Content-addressable store + symlinks → 2–3× faster, far less disk space. | Symlink quirks on edge cases; some tools choke. |
| yarn (v4 Berry) | Plug'n'Play optional, zero-installs, modern features. | PnP breaks tools that expect a real node_modules. |
| bun | Fastest of all (Zig); install = milliseconds. | Younger ecosystem; some incompatibilities. |
package.json for direct deps.node_modules (or symlink from a global store).preinstall, postinstall).pnpm stores every version of every package once on disk in ~/.pnpm-store, and creates symlinks into each project's node_modules. Result:
A single repo with multiple package.json files. The package manager links workspace packages locally — change one, the others pick it up immediately.
// package.json (root) { "workspaces": ["packages/*", "apps/*"] }
For more sophisticated monorepos, layer Turborepo, Nx, Moon, or Lerna on top.
npm ci / pnpm install --frozen-lockfile in CI — fails if the lockfile is out of date.npm — bundled with Node, works everywhere, fine for solo projects.
pnpm — best for monorepos and developers with many projects.
bun — fastest installs by far, increasingly compatible.
Yarn 4 (Berry) — strong monorepo features, optional zero-install.