Error Knowledge Base NPM EPUBLISHCONFLICT

npm ERR! code EPUBLISHCONFLICT

The registry rejected the publish because the version already exists (publish conflict).

Affected versions: All supported npm versions.

What This Error Means

The registry rejected the publish because the version already exists (publish conflict).

How to Fix It

  1. Check which registry npm is using: npm config get registry.
  2. If the package is scoped, verify scope registry mapping in .npmrc (example: @your-scope:registry=...).
  3. You cannot overwrite an existing version on npm registries. Bump the version and publish again.
  4. 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

  1. Run npm view <pkg>@<version> and confirm the new version exists after publish.
  2. Re-run publish and confirm the registry accepts it.

Manual validation checklist

  1. Preview what will be published: npm pack --dry-run (or npm pack and inspect the tarball).
  2. Confirm effective registry: npm config get registry.

Common CLI Output

npm ERR! code EPUBLISHCONFLICT
npm ERR! Cannot publish over existing version.

How npm surfaces this error

  1. Registries treat versions as immutable. A version conflict is an expected protection.
  2. 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 pack before 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(() => ({}))
}

Need help or found a mistake? Contact RepoFlow support for questions.

Join our mailing list