npm ERR! Invalid Version: (semver parse error)
A package.json or lockfile contains a version string that isn’t valid semver.
Seen on:
npm
Meaning
Typos in package.json "version", corrupted lockfiles, or dependencies with broken metadata.
Common causes
- Invalid "version" in your package.json
- Corrupted package-lock.json
- Malformed dependency metadata
⚡ Quick fix
- Fix the version field (e.g. 1.0.0)
- Regenerate the lockfile
- Run npm install --verbose to find the offending package
Detailed fix by platform
npm
rm package-lock.json && npm install --verbose
How to diagnose
- Source — Which package.json?
- Lockfile — Corrupted?
🧠 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