How to fix npm ERR! 409 Conflict in npm
The HTTP 409 Conflict error in npm occurs during publish operations when there's a version conflict. This usually means you're trying to publish a version that already exists or there's a concurrent modification.
Quick fix
Fixes npm ERR! 409 Conflict
npm view your-package versions
# Or check specific version
npm view your-package@1.0.0- Check if version exists
- Bump the version
- Check package.json version
- Handle partial publish failures
npm view your-package versions# Or check specific versionnpm view your-package@1.0.0npm ERR! 409 Conflict
What this error means
HTTP 409 Conflict indicates that the request conflicts with the current state of the resource on the server. In npm's context, this most commonly happens when trying to publish a package version that already exists in the registry. The registry maintains strict versioning - once a version is published, it cannot be republished with different content. This ensures reproducible builds across the ecosystem.
Typical symptoms
- npm publish fails with 409 Conflict
- Error mentions "cannot publish over existing version"
- Package shows as published but publish still fails
- CI/CD pipeline fails on release
- Manual publish after automated one fails
- Error occurs after failed partial publish
Common causes
- Version already exists in registry
- Failed to bump version before publish
- Concurrent publish attempts
- Previously failed publish left partial state
- Package was published and unpublished
- Version number in package.json not updated
- Merge conflict in package.json version
How to fix "npm ERR! 409 Conflict"
Verify what versions are published:
npm view your-package versions
# Or check specific version
npm view your-package@1.0.0If version exists, you need a new version number.
Increment the version properly:
# Patch version (1.0.0 -> 1.0.1)
npm version patch
# Minor version (1.0.0 -> 1.1.0)
npm version minor
# Major version (1.0.0 -> 2.0.0)
npm version majorThis updates package.json and creates a git tag.
Ensure version is correct:
cat package.json | grep versionManually edit if needed, but prefer npm version for automation.
If a previous publish partially succeeded:
# Wait a few minutes for registry to sync
# Then check if it's actually published
npm view your-package@version
# If not published, try again
npm publish
# If partially published, bump version and republishIn rare cases where version doesn't truly exist:
npm publish --force⚠️ This won't override existing versions, but may help with stale registry state.
Prevent future conflicts:
// package.json - use semantic-release or similar
{
"scripts": {
"release": "semantic-release"
}
}Or use npm version in CI before publish.
Advanced notes
npm's immutability policy means published versions cannot be changed. Use semantic versioning (semver) to manage versions properly. For monorepos, tools like Lerna or Changesets help coordinate multi-package version bumps. In CI/CD, use npm version --no-git-tag-version if git tags are managed separately. Consider using alpha/beta/rc versions for pre-releases.
Frequently asked questions
- What does "npm ERR! 409 Conflict" mean?
- HTTP 409 Conflict indicates that the request conflicts with the current state of the resource on the server. In npm's context, this most commonly happens when trying to publish a package version that already exists in the registry. The registry maintains strict versioning - once a version is published, it cannot be republished with different content.
- How do I fix "npm ERR! 409 Conflict"?
- The HTTP 409 Conflict error in npm occurs during publish operations when there's a version conflict. This usually means you're trying to publish a version that already exists or there's a concurrent modification.
- What causes "npm ERR! 409 Conflict"?
- Version already exists in registry Failed to bump version before publish Concurrent publish attempts
- Is the "npm ERR! 409 Conflict" error serious?
- It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.