Fix it fast
Most likely: The exact package version is already published to the registry. npm registries do not let you overwrite an existing version.
1. Confirm this is your error
npm ERR! code EPUBLISHCONFLICT
npm ERR! Cannot publish over existing version. 2. Check the cause
npm config get registry
npm pkg get name
npm pkg get version
npm view <package> versions --json 3. Apply the safe fix
# Bump to a new version, review the package contents, then publish.
npm version patch
npm pack --dry-run
npm publish 4. Verify it works
npm view <package>@<new-version>
npm view <package> versions --json Don't use unsafe shortcuts
- Do not try to overwrite an already published version.
- Do not unpublish/re-publish as a normal release workflow.
- Do not publish to a different registry accidentally just to bypass the conflict.
What This Error Means
Read this as a precise clue about which part of the workflow broke first. Once you know the failing layer, the fix path gets much shorter.
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
Usually this comes down to the version is already published (most common), the package metadata is invalid or violates registry policy, or you are publishing to the wrong registry or scope.
Verify the Fix
Run npm view <pkg>@<version> and confirm the new version exists after publish, and re-run publish and confirm the registry accepts it.
Manual validation checklist
Preview what will be published with npm pack --dry-run (or npm pack and inspect the tarball), and confirm effective registry with npm config get registry.
How npm surfaces this error
Registries treat versions as immutable. A version conflict is an expected protection. Invalid package metadata causes publish validation errors.
Prevent It From Coming Back
To prevent this, automate version bumps as part of release workflow, keep registry routing explicit for scoped packages, and validate package contents with npm pack before publishing.
Docs and source code
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(() => ({}))
}