NPM-UNPUBLISH(1)

πŸ’… npm-unpublish β€” like, the page for npm unpublish

okay so bestie, welcome to npm-unpublish(1) β€” the manual page that tells you how to yeet a package out of the registry πŸ—‘οΈβœ¨ yes, for real, this is the delete button for published packages and it is highkey not a casual button. sit with me, we're gonna get through this together 🫢

πŸŽ€ NAME

npm-unpublish β€” Remove a package from the registry

⭐ Synopsis

npm unpublish [<package-spec>]

and if you wanna know how the npm registry actually treats an unpublish (because it has opinions, bestie), go read the unpublish policies here: https://docs.npmjs.com/policies/unpublish πŸ’–

🚨 Warning

okay real talk before anything else: consider using the npm help deprecate command instead, if what you're actually trying to do is nudge users to upgrade, or if you just don't wanna maintain a package anymore. deprecate is the gentle option, unpublish is the dramatic option 😭 lowkey think about it first.

🌸 DESCRIPTION

This removes a package version from the registry β€” it deletes its entry and removes the tarball. gone. poof. πŸ¦‹

The npm registry will straight up return an error if you are not npm help "logged in" β€” so log in first, no cap πŸ”‘

If you do not specify a package name at all, then the name and version to be unpublished get pulled from the project in the current directory. it just… looks around your folder and figures it out πŸ‘€

If you specify a package name but do not specify a version, or if you remove all of a package's versions, then the registry will remove the root package entry entirely. whole thing. gone. πŸ’€

⚠️ and here's the part that lives in my head rent free: even if you unpublish a package version, that specific name and version combination can never be reused. ever. if you wanna publish the package again you must use a new version number. and if you unpublish the entire package, you may not publish any new versions of that package until 24 hours have passed. twenty-four. hours. 😭⏳

✨ CONFIGURATION ✨

--dry-run πŸ§ͺ

  • Default: false
  • Type: Boolean

This one tells npm "bestie don't touch anything, just tell me what you would've done" πŸ™ˆ β€” it only reports what it would have done, no actual changes. You can pass this into any of the commands that modify your local installation, like install, update, dedupe, uninstall, and also pack and publish.

πŸ“Œ Note: this is NOT honored by other network related commands, like dist-tags, owner, etc. so don't come for me when it does nothing there πŸ’…

--force πŸ’₯

  • Default: false
  • Type: Boolean

Removes various protections against unfortunate side effects, common mistakes, unnecessary performance degradation, and malicious input. it's the "remove the guardrails" option, and the guardrails are there for a reason bestie:

  • Allow clobbering non-npm files in global installs.
  • Allow the npm version command to work on an unclean git repository.
  • Allow deleting the cache folder with npm cache clean.
  • Allow installing packages that have an engines declaration requiring a different version of npm.
  • Allow installing packages that have an engines declaration requiring a different version of node, even if --engine-strict is enabled.
  • Allow npm audit fix to install modules outside your stated dependency range (including SemVer-major changes).
  • Allow unpublishing all versions of a published package.
  • Allow conflicting peerDependencies to be installed in the root project.
  • Implicitly set --yes during npm init.
  • Allow clobbering existing values in npm pkg
  • Allow unpublishing of entire packages (not just a single version).
🚨 If you don't have a clear idea of what you want to do, it is strongly recommended that you do not use this option! like, seriously. I'm not being cute about this one. 😭

--workspace πŸ—‚οΈ

  • Default: (empty)
  • Type: String (can be set multiple times)

Enables running a command in the context of the configured workspaces of the current project, while filtering by running only the workspaces defined by this configuration option ✨

Valid values for the workspace config are either:

  • Workspace names
  • Path to a workspace directory
  • Path to a parent workspace directory (will result in selecting all workspaces within that folder)

When set for the npm init command, this may be set to the folder of a workspace which does not yet exist β€” so it creates the folder and sets it up as a brand new workspace within the project. it's giving manifesting 🌱

This value is not exported to the environment for child processes.

--workspaces 🌈

  • Default: null
  • Type: null or Boolean

Set to true to run the command in the context of all configured workspaces. all of them. the whole squad πŸ‘‘

Explicitly setting this to false will cause commands like install to ignore workspaces altogether. When not set explicitly:

  • Commands that operate on the node_modules tree (install, update, etc.) will link workspaces into the node_modules folder.
  • Commands that do other things (test, exec, publish, etc.) will operate on the root project, unless one or more workspaces are specified in the workspace config.

This value is not exported to the environment for child processes.


πŸ” SEE ALSO

  • npm help "package spec"
  • npm help deprecate
  • npm help publish
  • npm help registry
  • npm help owner
  • npm help login

and that's the whole page, bestie!! πŸ’– you're officially an unpublish understander. go forth responsibly, don't delete things you love, and remember the 24 hour rule πŸ•βœ¨

this has been NPM@12.2.1, dated October 2026, signing off from the NPM-UNPUBLISH(1) corner of the manual πŸŽ€πŸ¦‹ mwah!

πŸ“¦ where this page comes from