npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

Can npm publish same version npm package with different tag?

In my case, i have published a npm package @a/b with npm publish --tag beta which version is 1.0.1 for beta version testing. And once test done, i try to publish same package to formal npm registry by scripting npm publish --tag latest . Then 403 error occurs, showing forbidden cannot modify pre-existing version . Is there any way to publish test version package and production version package with some version?
Also, i try some solution like npm unpublish @a/b@1.0.1 , but it fail if i am not administrator for npm registry(maybe a company internal registry). So, i just patch a new version and publish it without any code changed…

Some discuss in github is still open…


I do not think you can republish without changing version.

The semver pattern you can follow is to version the beta version as a prerelease, then the version number changes naturally when you release again. https://semver.org/#spec-item-9

The nvm version command includes prerelease.


Thx for your reply.
Semver is great, and i follow it as well. It would resolve my problem in strict semver regulation in my case. But i still wonder why tag is so strict in npm not like tag in git. There’s one case
that developer using tag as feature usage, and i think it makes sense somehow. https://github.com/npm/npm/issues/20365#issuecomment-395499091