Fix it fast
Most likely: You are trying to publish a package version that already exists, or the registry has a conflicting package state for that publish request.
1. Confirm this is your error
npm ERR! code E409 2. Check the cause
npm config get registry
node -p "require('./package.json').name + '@' + require('./package.json').version"
npm view <package> versions --json --registry <registry>
npm pack --dry-run 3. Apply the safe fix
# npm package versions are immutable. Bump the version, then publish the new version.
npm version patch
npm publish --registry <registry> 4. Verify it works
npm view <package>@<new-version> --registry <registry>
npm install <package>@<new-version> Don't use unsafe shortcuts
- Do not try to overwrite an already published version.
- Do not delete and republish to fix normal release mistakes, publish a corrected new version.
- Do not publish to a different registry just to bypass the conflict unless that registry is intentionally the target.
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(() => ({}))
}