Error Knowledge Base NPM EPUBLISHCONFLICT

npm ERR! code EPUBLISHCONFLICT

npm could not publish because that package version already exists in the registry, so you need a new version before publishing again.

What This Error Means

npm could not publish because that package version already exists in the registry, so you need a new version before publishing again.

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 (or npm pack and inspect the tarball).

Confirm effective registry:npm config get registry

Examples

npm ERR! code EPUBLISHCONFLICT
npm 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 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