Skip to content

relizy / isVersionAlreadyPublishedError

Function: isVersionAlreadyPublishedError() ​

isVersionAlreadyPublishedError(error): boolean

Defined in: src/core/npm.ts:516

Detect whether a failed publish is caused by the version already existing on the registry (the registry refusing to overwrite an immutable asset), as opposed to any other publish failure. This is what makes a retry safe: the artifact is already there, so the failure is really a "nothing to do".

Registries phrase this differently, so we match the known variants:

  • npm public registry / verdaccio: EPUBLISHCONFLICT, cannot publish over the previously published versions, you cannot publish over ...;
  • Nexus: Repository does not allow updating assets (HTTP 400);
  • Artifactory/JFrog and others: already exists / version already exists;
  • a bare HTTP 409 Conflict from a registry that returns no message body.

Parameters ​

error ​

unknown

Returns ​

boolean

Released under the MIT License.