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
npm publish
Uploads the current package to the registry so it can be installed by others. Honors the `files` field, `.npmignore`, and .gitignore to decide which files ship.
npm version
Bumps the version field in package.json (and package-lock.json), then creates a git commit and tag — all in one step. Runs preversion/version/postversion lifecycle scripts.
npm pack
Creates the tarball (`<name>-<version>.tgz`) exactly as `npm publish` would upload, without actually publishing. Perfect for previewing shipped files or for installing locally to test.