Validates that your lockfile is in sync with package.json. Works with npm, yarn, and pnpm. Zero dependencies.
Catches the silent bug where someone edits package.json (adds/removes a dep) without running install, then pushes code that breaks for everyone else.
npm install -g lockcheckOr without installing:
npx lockcheck# Check current directory
lockcheck
# Check a specific project
lockcheck ./backend
# CI / git-hook mode — exit 1 on any issue
lockcheck --strict
# Check multiple projects
lockcheck ./frontend ./backend ./sharedIn sync:
lockcheck my-app
npm · package-lock.json · 42 declared deps
✓ Lockfile is in sync. All 42 declared deps found.
Out of sync:
lockcheck my-app
npm · package-lock.json · 45 declared deps
✘ 3 package(s) in package.json not found in lockfile:
express
cors
helmet
Run `npm install` to update the lockfile.
Stale lockfile:
⚠ package-lock.json is older than package.json — you may need to run install
Add to .git/hooks/pre-push (or use with husky):
#!/bin/sh
npx lockcheck --strictMake it executable:
chmod +x .git/hooks/pre-push# .github/workflows/lockcheck.yml
- name: Validate lockfile
run: npx lockcheck --strict| Manager | Lockfile |
|---|---|
| npm | package-lock.json (v1, v2, v3) |
| yarn | yarn.lock (classic & berry) |
| pnpm | pnpm-lock.yaml |
- Missing packages — deps declared in
package.jsonnot found in the lockfile - Stale lockfile —
package.jsonwas modified more recently than the lockfile (warn by default, error with--strict)
MIT
lockfile · package-lock.json · yarn.lock · pnpm-lock · dependency check · lockfile sync · npm ci · stale lockfile · zero dependencies · cli
Built to solve, shared to help — Rushabh Shah 🛠️✨
One of 40+ zero-dependency developer CLI tools — no node_modules, ever.