npm / npm/cli

[BUG] `npm unpublish <package>@<version> -f` unpublishes all versions

Open
#6,786 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Needs Triage Release 9.x
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

Is there an existing issue for this?
  • I have searched the existing issues
This issue exists in the latest npm version
  • I am using the latest npm
Current Behavior

Hello!

Yesterday I published a new version of my package: sequential-workflow-designer. After the publication, I found a bug so I wanted to delete this version and publish the fixed version. I executed this command:

npm unpublish sequential-workflow-designer@0.15.0 -f

Unfortunately the version in the command has not been taken into account, and npm unpublished the whole package.

Expected Behavior

The cli should unpublish only the specific version.

Steps To Reproduce
npm unpublish <package>@<version> -f
Environment
  • npm: 9.6.7
  • Node.js: v18.17.0
  • OS Name: macOS Ventura 13.5 (22G74)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing npm unpublish <package>@<version> -f with npm 9.6.7 and inspect the npm CLI implementation for the unpublish command. Trace how the package and version arguments are parsed, then add a regression test showing that only the requested version is removed while other versions remain.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.