publish

npm unpublish

Removes a specific version — or the whole package — from the registry. Subject to strict rules: only within 72 hours of publish and only if nothing else depends on it.

npm unpublish [<@scope>/]<pkg>[@<version>] [--force]

Common flags

Flag Purpose
--force (-f) Required to unpublish the entire package (all versions)
--dry-run Show what would be unpublished without touching the registry
--registry <url> Target a specific registry

Examples

npm unpublish [email protected]

Remove a single version within 72 hours of publish

npm unpublish my-pkg --force

Remove the entire package (only allowed under strict conditions)

npm unpublish --dry-run [email protected]

Preview the operation

Gotcha

After 72 hours you cannot unpublish — you can only `npm deprecate` the version. Even successfully unpublished names cannot be re-published for 24 hours, and the registry blocks removal once anything depends on it.

Related commands

← All npm commands · npm vs pnpm vs Yarn · Fix Node OOM