pnpm unpublish

Remove a published package version from the registry.

pnpm unpublish <pkg>[@<version>] [--force]

Warning

Unpublishing is generally discouraged. Most registries (including the public npm registry) restrict when and how packages can be unpublished. Prefer pnpm deprecate whenever possible.

Examples#

Unpublish a specific version:

pnpm unpublish foo@1.0.0

Unpublish a range of versions using a semver specifier:

pnpm unpublish "foo@<2"

When some versions remain, pnpm drops the dist-tags that pointed at the removed versions and moves latest to the highest remaining version.

Unpublish an entire package (all versions). Requires --force:

pnpm unpublish foo --force

A package name is required. Without one, the command fails with ERR_PNPM_UNPUBLISH_REQUIRED.

Options#

--force#

Required when removing an entire package (all versions) rather than a specific version or range. A range that matches every published version also counts as removing the entire package. Without --force, the command fails with ERR_PNPM_UNPUBLISH_CONFIRM.

If the registry does not allow removing the entire package, the command fails with ERR_PNPM_UNPUBLISH_FORBIDDEN. Deprecate the package instead.

--registry <url>#

The registry to remove the package from. Defaults to the registry configured for the package.

--otp <code>#

When the registry requires two-factor authentication, supply the one-time password with this option.