What This Error Means
The registry rejected the publish because the version already exists (publish conflict).
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=...). - You cannot overwrite an existing version on npm registries. Bump the version and publish again.
- Confirm what is already published:
npm view <pkg> versions --json.
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 EPUBLISHCONFLICTnpm ERR! Cannot publish over existing version. 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(() => ({}))
}