What This Error Means
The registry rejected the publish payload as invalid (unprocessable entity).
How to Fix It
- Check which registry npm is using:
npm config get registry. - If the package is scoped, verify scope registry mapping in
.npmrc(example:@your-scope:registry=...). - Validate
package.jsonfields (name, version, files) and ensure the package packs correctly:npm pack. - Check for invalid semver or forbidden characters in the package name.
Why It Happens
- The version is already published (most common).
- The package metadata is invalid or violates registry policy.
- You are publishing to the wrong registry or scope.
How to Verify
- Run
npm view <pkg>@<version>and confirm the new version exists after publish. - Re-run publish and confirm the registry accepts it.
Manual validation checklist
- Preview what will be published:
npm pack --dry-run(ornpm packand inspect the tarball). - Confirm effective registry:
npm config get registry.
Common CLI Output
npm ERR! code E422npm ERR! 422 Unprocessable Entity - PUT https://registry.npmjs.org/npm-sync - Unprocessable Entity How npm surfaces this error
- Registries treat versions as immutable. A version conflict is an expected protection.
- Invalid package metadata causes publish validation errors.
Prevention Tips
- Automate version bumps as part of release workflow.
- Keep registry routing explicit for scoped packages.
- Validate package contents with
npm packbefore publishing.
Where This Can Be Triggered
github.com/npm/cli/blob/417daa72b09c5129e7390cd12743ef31bf3ddb83/lib/utils/ping.js
This is a registry request path. Many resolution/publish errors happen while fetching or publishing package metadata to the registry. - GitHub
// used by the ping and doctor commands
const npmFetch = require('npm-registry-fetch')
module.exports = async (flatOptions) => {
const res = await npmFetch('/-/ping', { ...flatOptions, cache: false })
return res.json().catch(() => ({}))
}