package.json Validator
Validate a package.json file for common issues: missing required fields (name, version), invalid semver, missing main/exports for libraries, files-array problems, scripts that reference undefined commands, dependency duplication between deps and devDeps.
How to use the package.json Validator
Paste your package.json. The validator reports structural issues, semver problems, and questionable patterns. It doesn't run npm install — runtime issues (missing peer deps, version conflicts) need npm ls or a real installer.
Validating a package.json
package.json is the manifest every Node tool reads, and small mistakes in it cause outsized problems: an invalid semver string, a missing main or exports entry that makes a published library unimportable, a dependency listed in both dependencies and devDependencies, or a script pointing at a binary that was never installed. Many of these fail quietly until a publish or a CI install.
This checks a package.json for required fields, semver validity, library entry points, files-array problems, and dependency duplication, reporting issues without running an install. It does not resolve the dependency graph — for peer-dependency or version-conflict problems reach for npm ls or a real installer; to estimate what a dependency weighs before adding it, the npm size estimator, and to bump the version field correctly, the semver bumper.
Common use cases
- Pre-publish check — catch manifest errors before
npm publish. - Validate semver — confirm the version string is well-formed.
- Library entry points — verify
main/exportsso the package imports. - Spot duplication — find deps listed in both dependencies and devDependencies.
- CI sanity — fail fast on a malformed manifest.