Skip to content
gohacks.dev
Standard Library

Package Manager Commands

Compare the commands of npm, pnpm, Yarn, Bun, Composer, uv and pip side by side: CI installs, adding and removing dependencies, updates, audits, running scripts and binaries, and lock files.

Free · No sign-up · Your inputs stay in your browser

Input

npm, pnpm, Yarn, Bun, Composer and uv commands side by side

Output

npm to pnpm

Tasknpmpnpm
Install from the lock file (CI)npm cipnpm install --frozen-lockfile
Install everythingnpm installpnpm install
Add a dependencynpm install zodpnpm add zod
Add a dev dependencynpm install -D vitestpnpm add -D vitest
Remove a dependencynpm uninstall zodpnpm remove zod
Update within rangesnpm updatepnpm update
List outdatednpm outdatedpnpm outdated
Why is this installed?npm explain lodashpnpm why lodash
Security auditnpm auditpnpm audit
Run a scriptnpm run buildpnpm build
Run a package binary oncenpx cowsay hipnpm dlx cowsay hi
Global installnpm install -g pkgpnpm add -g pkg
Lock filepackage-lock.jsonpnpm-lock.yaml

Yarn here is Yarn 4 (Berry); Yarn 1 commands are closer to npm's. The CI row matters most: an install that may rewrite the lock file in CI means the build can run different code from the one that was reviewed. Commit the lock file of whichever tool you use, and only one of them.

Runs in this browser. Nothing you paste is sent to a server.

The CI install matters most

npm ci, pnpm install --frozen-lockfile, yarn install --immutable and composer install fail if the lock file and manifest disagree instead of quietly updating the lock file. That guarantees the build installs exactly what was reviewed. The npm ci documentation describes the behaviour.

One tool per project

Lock files of different managers do not agree, and two in one repository means two dependency trees. Pick one, commit its lock file and set packageManager in package.json so Corepack enforces the choice.

Share

Frequently asked questions

What is the difference between npm install and npm ci?
npm install may update package-lock.json to satisfy package.json; npm ci installs exactly what the lock file says, deletes node_modules first and fails on a mismatch.
What is uv?
A fast Python package and project manager from Astral that replaces pip, pip-tools and virtualenv workflows, with a uv.lock lock file.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools