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.

例#

Unpublish a specific version:

pnpm unpublish foo@1.0.0

Unpublish a range of versions using a semver specifier:

pnpm unpublish "foo@<2"

If a removed version held the latest tag, pnpm moves the tag to the highest remaining stable version. If only prereleases remain, it selects the highest prerelease.

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.