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.
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.
Verify what versions are published:
npm view your-package versions
# Or check specific version
npm view [email protected]If 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.
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.
npm ERR! code ENOAUDIT npm ERR! Audit endpoint not supported
How to fix "npm ERR! code ENOAUDIT - Audit endpoint not supported"
npm ERR! code EBADDEVENGINES npm ERR! devEngines.runtime incompatible with current node version
How to fix "npm ERR! code EBADDEVENGINES - devEngines.runtime incompatible with current node version"
npm ERR! code ETOOMANYARGS npm ERR! Too many arguments
How to fix "npm ERR! code ETOOMANYARGS - Too many arguments"
npm ERR! code EINVALIDTAGNAME npm ERR! Invalid tag name: tag names cannot contain spaces
How to fix "npm ERR! code EINVALIDTAGNAME - tag names cannot contain spaces"
npm ERR! code E400 npm ERR! 400 Bad Request
How to fix "npm ERR! code E400 - 400 Bad Request" error