How to fix npm ERR! code EPUBLISHCONFLICT npm ERR! Cannot publish over existing version. Bump the version in package.json and try again in npm

npmBEGINNERHIGHUpdated Dec 5, 2025· 221 views

EPUBLISHCONFLICT occurs when you attempt to publish a package version that already exists in the npm registry. Bump your version number using npm version patch/minor/major and publish again.

Quick fix

Fixes EPUBLISHCONFLICT

npm view your-package-name version
cat package.json | grep "version"
  1. Verify the current package version
  2. Increment the version number
  3. Ensure you are authenticated and publishing to the correct registry
  4. Update npm and Node.js to the latest versions
npm — error
npm view your-package-name version
cat package.json | grep "version"
npm ERR! code EPUBLISHCONFLICT
npm ERR! Cannot publish over existing version. Bump the version in package.json and try again

What this error means

This error occurs when you attempt to publish a package version to npm that already exists in the registry. npm enforces strict version immutability—once a specific version number is published, that exact name-and-version combination can never be reused. This is a deliberate design choice to ensure package integrity and prevent accidentally overwriting previously released code. The registry rejects the publish attempt to protect users from potential confusion or security issues.

Typical symptoms

  • npm publish command fails with 'EPUBLISHCONFLICT' error code
  • Error message states 'Cannot publish over existing version'
  • You recently unpublished a version and cannot republish it
  • Publishing works for new versions but fails for the current package.json version
  • CI/CD pipeline fails at the npm publish step without version changes

Common causes

  1. The version in package.json matches a previously published release to the npm registry
  2. You unpublished a version and are attempting to publish the same version number again (unpublished versions cannot be reused)
  3. Outdated npm client version causing race conditions or version detection issues
  4. Publishing to a private registry that proxies to npmjs and conflicts with existing public packages
  5. Manual version changes to package.json that match an already-published version number
  6. Network or server issues during a previous publish attempt left the registry in an inconsistent state

How to fix "npm ERR! code EPUBLISHCONFLICT npm ERR! Cannot publish over existing version. Bump the version in package.json and try again"

1Verify the current package version

Check what version is currently published to npm and compare it with your package.json:

bash
npm view your-package-name version
cat package.json | grep "version"

If the published version matches your local package.json version, this confirms the conflict.

2Increment the version number

Update your package.json to a new, unique version. Use npm's built-in version commands:

bash
# For bug fixes (1.0.0 -> 1.0.1)
npm version patch

# For new features (1.0.0 -> 1.1.0)
npm version minor

# For breaking changes (1.0.0 -> 2.0.0)
npm version major

These commands automatically update package.json and create a git tag.

3Ensure you are authenticated and publishing to the correct registry

Confirm your npm authentication and target registry:

bash
# Check your current authentication
npm whoami

# Verify the registry URL
npm config get registry

# View your account's published packages
npm owner ls your-package-name

Ensure you're logged in and publishing to the correct registry.

4Update npm and Node.js to the latest versions

Outdated npm versions can experience race conditions and version detection issues:

bash
# Update npm globally to latest
npm install npm@latest -g

# Check npm version
npm --version
5Publish with the new version

After incrementing the version, publish your package:

bash
# Standard publish to public registry
npm publish

# If publishing a pre-release (beta, alpha, etc.)
npm publish --tag beta

# For scoped packages, ensure public access (if desired)
npm publish --access public

Verify the publish succeeded:

bash
npm view your-package-name versions
6For private registries: Adjust configuration

If using a private registry like Verdaccio that proxies to npmjs, adjust the configuration:

yaml
# Edit config.yaml
packages:
  '@scope/*':
    access: $authenticated
    publish: $authenticated

Or explicitly specify the registry when publishing:

bash
npm publish --registry https://your-verdaccio-instance.com

Advanced notes

If you accidentally published the wrong code to a version, you have limited options: npm supports unpublishing within 72 hours of publication, but unpublished versions cannot be republished with the same version number. The recommended approach is to publish a new patch version with the corrections. For critical security issues, publish a newer patch immediately and deprecate the old version with npm deprecate your-package@1.0.0 'This version has security issues, please upgrade'. When using CI/CD pipelines, ensure the version bump happens before npm publish, and consider using tools like semantic-release to automate versioning.

Frequently asked questions

What does "EPUBLISHCONFLICT" mean?
This error occurs when you attempt to publish a package version to npm that already exists in the registry. npm enforces strict version immutability—once a specific version number is published, that exact name-and-version combination can never be reused. This is a deliberate design choice to ensure package integrity and prevent accidentally overwriting previously released code.
How do I fix "EPUBLISHCONFLICT"?
EPUBLISHCONFLICT occurs when you attempt to publish a package version that already exists in the npm registry. Bump your version number using npm version patch/minor/major and publish again.
What causes "EPUBLISHCONFLICT"?
The version in package.json matches a previously published release to the npm registry You unpublished a version and are attempting to publish the same version number again (unpublished versions cannot be reused) Outdated npm client version causing race conditions or version detection issues
Is the "EPUBLISHCONFLICT" error serious?
Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.

Official resources & further reading