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 notice access token expired or revoked. Please try logging in again.
Token has expired - npm authentication failure
npm ERR! code EAI_AGAIN
How to fix "EAI_AGAIN" in npm
npm error code E403 npm error 403 Forbidden - PUT https://registry.npmjs.org/<package>
How to fix 'E403 Forbidden' error in npm
npm ERR! code EUSAGE npm ERR! Usage error
How to fix "npm ERR! code EUSAGE" in Node.js projects
npm ERR! code E401 npm ERR! 401 Unauthorized
How to fix "E401 Unauthorized" in npm