Home > Back-end >  Google Artifact Registry: Unable to publish package with the same version even after package deletio
Google Artifact Registry: Unable to publish package with the same version even after package deletio

Time:09-25

I'm trying to publish npm package to the google artifact registry (GAR).

A package with the same version has already been published, but I've deleted it manually from the GAR.

npm view <package-name>@0.1.3

<empty response>

But still unable to publish the package.

npm publish

npm ERR! code E400
npm ERR! 400 Bad Request - PUT https://<package-url> - Requested version(0.1.3) already exists.

Looks like it has been cached somewhere. If so is there any possibility to clear the cache?

CodePudding user response:

Actually Cloud Artifacts Registry does not allow that, according to this documentation:

You can only publish a specific version of a package once. This is an npm restriction to ensure that the contents of a published package version are always the same. As a result, you cannot:

  • Overwrite a package version by publishing it again to the repository
  • Remove a package or its version from the repository, and then publish a package with the same name and version number

So you are going to have to create another version in order to publish the package.

  • Related