npm ERR! code ELSPROBLEMS — invalid / extraneous / missing packages in npm ls
npm ls found the installed tree doesn’t match package.json and the lockfile.
Seen on:
npm
Meaning
“invalid” means an installed version doesn’t satisfy the declared range, “extraneous” means installed but not declared, “missing” means declared but not installed. Often after manual edits, interrupted installs or mixing package managers.
Common causes
- Interrupted or partial install
- Manual edits to node_modules or package.json
- Mixing npm with yarn/pnpm in one project
- Peer dependency ranges not satisfied
⚡ Quick fix
- Reinstall cleanly: rm -rf node_modules && npm ci
- Remove extraneous packages: npm prune
- Fix ranges flagged as invalid
Detailed fix by platform
npm
npm ls --all 2>&1 | grep -E "invalid|missing|extraneous"
How to diagnose
- Problems — Which packages are listed?
- Lockfile — In sync with package.json?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026