How to fix npm ERR! code E403 npm ERR! 403 Forbidden - PUT https://registry.npmjs.org/package - You cannot publish over the previously published versions in npm
This error occurs when you attempt to publish an npm package with a version number that already exists in the registry. npm enforces version immutability for security and ecosystem stability—once a version is published, it can never be overwritten or reused.
Quick fix
Fixes npm ERR! code E403 npm ERR! 403 Forbidden - PUT https://registry.npmjs.org/package - You cannot publish over the previously published versions
npm info your-package-name- Check the current published version
- Increment the version number
- Verify the new version before publishing
- Publish the new version
npm info your-package-namenpm ERR! code E403npm ERR! 403 Forbidden - PUT https://registry.npmjs.org/package - You cannot publish over the previously published versions
What this error means
This error occurs when you attempt to publish an npm package with a name and version combination that already exists in the registry. npm enforces version immutability for security and ecosystem stability—once a version is published, it can never be overwritten or reused, even if it's unpublished. This is a deliberate design choice to prevent supply-chain attacks where a malicious actor could replace legitimate code with compromised code while keeping the same version number. The immutability guarantee ensures that once you depend on a specific version, the code behind that version will never change. This protection applies to both public and scoped packages on the npm registry.
Typical symptoms
- npm ERR! code E403 with '403 Forbidden'
- Error message states 'You cannot publish over the previously published versions'
- npm publish command fails before uploading package contents
- Error occurs for both public and scoped packages
- May appear after initial publish attempt or in CI/CD pipelines
Common causes
- Attempting to publish the same version number as an existing published package
- In monorepos (Lerna, Yarn Workspaces), a partial publish succeeded before failure
- Trying to reuse a version number even after unpublishing (permanently reserved)
- Forgot to bump version number after previous successful publish
- CI/CD pipeline ran twice without version increment between runs
How to fix "npm ERR! code E403 npm ERR! 403 Forbidden - PUT https://registry.npmjs.org/package - You cannot publish over the previously published versions"
Query the npm registry to see what versions already exist:
npm info your-package-nameOr for scoped packages:
npm info @your-username/package-nameThis shows all published versions. Note the highest version number currently published.
Update the version field in your package.json to a higher version following semantic versioning:
# For patch release (1.0.0 -> 1.0.1)
npm version patch
# For minor release (1.0.0 -> 1.1.0)
npm version minor
# For major release (1.0.0 -> 2.0.0)
npm version majorThe npm version command automatically creates a git commit and tag.
Double-check that your package.json now contains a unique version number:
cat package.json | grep versionConfirm this version does NOT appear in the npm info output from Step 1.
Now publish with the incremented version:
npm publishFor scoped packages that should be public:
npm publish --access publicConfirm the new version is available:
npm info your-package-nameYou should see your new version in the list of published versions.
Advanced notes
Immutability and Security: npm enforces strict version immutability to prevent supply-chain attacks. Once a version is published, it can never be modified or reused, even if unpublished.
Unpublish Policy: You can unpublish a newly published package within 72 hours only if no other packages depend on it. After 72 hours, unpublishing is not allowed unless the package has zero dependents. Even when unpublished, the version number remains permanently reserved.
24-Hour Waiting Period: If you unpublish an entire package, you cannot publish any new versions of that package until 24 hours have passed.
Deprecation as Alternative: If your package doesn't meet unpublish criteria, use npm deprecate to mark it with a warning message while keeping it available for existing users.
Prerelease Versions: Use prerelease versions during development to avoid locking production version numbers:
{ "version": "1.0.0-alpha.1" }Increment prerelease: npm version prerelease → 1.0.0-alpha.2
Frequently asked questions
- What does "npm ERR! code E403 npm ERR! 403 Forbidden - PUT https://registry.npmjs" mean?
- This error occurs when you attempt to publish an npm package with a name and version combination that already exists in the registry. npm enforces version immutability for security and ecosystem stability—once a version is published, it can never be overwritten or reused, even if it's unpublished. This is a deliberate design choice to prevent supply-chain attacks where a malicious actor could replace legitimate code with compromised code while keeping the same version number.
- How do I fix "npm ERR! code E403 npm ERR! 403 Forbidden - PUT https://registry.npmjs"?
- This error occurs when you attempt to publish an npm package with a version number that already exists in the registry. npm enforces version immutability for security and ecosystem stability—once a version is published, it can never be overwritten or reused.
- What causes "npm ERR! code E403 npm ERR! 403 Forbidden - PUT https://registry.npmjs"?
- Attempting to publish the same version number as an existing published package In monorepos (Lerna, Yarn Workspaces), a partial publish succeeded before failure Trying to reuse a version number even after unpublishing (permanently reserved)
- Is the "npm ERR! code E403 npm ERR! 403 Forbidden - PUT https://registry.npmjs" error serious?
- It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.
Official resources & further reading
- 📚npm Official Documentation
- 📖Docs: npm publish(Official Docs)
- 💬SO: npm publish version conflict(Stack Overflow)