-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] npm unpublish --force <package-name>@<version>
deletes all versions
#7015
Comments
If npm is asking you to type The output telling you to use
npm is telling you it's trying to delete the whole project here. |
There are a lot of safeguards in npm that should prevent this from happening. It will only send a total package unpublish if you specify just a package name or are unpublishing the last existing version of a package. Can you double check your shell history to see exactly what you typed? We can't reproduce this on our end w/ any combination of parameters. |
There's several versions of the package now, and I was able to install version
|
Unpublished package versions can't ever be restored or republished, generally, so the second bullet point shouldn't be possible. |
No, there were multiple versions of the package published, f.e. 0.8.0, 0.9.0, and 0.10.0, among others.
Indeed that was fishy. I was trying to delete a specific version, and it was giving that message.
The commands in the OP were what I ran, but with single quotes around the package@version, while the last three published versions at the time were 0.10.0, 0.10.1, and 0.10.2.
There you can see my commands. The first one gave me the
I of course went and published a new patch version for each minor to restore the delete package because support told me it could not be restored. I published a new patch for each
It became a 404 page on npmjs.com, until I re-published the new patches for each minor.
Sorry, the OP was not entirely accurate: I used single quotes on the command that did the deletion of all versions (as per above |
I'm not angry anymore (and was never angry at anyone specifically), as I re-published the patches and went on my way. At worst, someone at a previous company might get an error and need to update a package.json version or a lock file. Hope you're able to eventually reproduce this, because it really did happen! |
I'm able to consistently reproduce the following: ❯ npm unpublish --dry-run '@lume/element@0.11.1'
npm WARN ignoring workspace config at /Users/trusktr/src/lume+lume/packages/element/.npmrc
npm ERR! code EUSAGE
npm ERR!
npm ERR! Refusing to delete entire project(s).
npm ERR! Run with --force to do this.
npm ERR!
npm ERR! Remove a package from the registry
npm ERR!
npm ERR! Usage:
npm ERR! npm unpublish [<package-spec>]
npm ERR!
npm ERR! Options:
npm ERR! [--dry-run] [-f|--force]
npm ERR! [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
npm ERR! [-ws|--workspaces]
npm ERR!
npm ERR! Run "npm help unpublish" for more info
npm ERR! A complete log of this run can be found in: /Users/trusktr/.npm/_logs/2023-11-29T05_27_53_659Z-debug-0.log where the latest published version is 0.11.4, and I have: Node: v20.6.1 Here's a full reproduction on my end: git clone git@github.com:lume/lume.git lume-npm-unpublish-test
cd lume-npm-unpublish-test
git checkout v0.3.0-alpha.34
git submodule update --init
cd packages/element/
npm unpublish --dry-run '@lume/element@0.11.1' Maybe workspaces throws something off? |
Sometimes I can reproduce, sometimes I can't. Does it have to do with git submodules? For example I canceled (ctrl+c) out of the |
Not sure about the ctrl+c state but if I had to guess it would be a state where the workspace's package.json hadn't gotten written to disk. This is definitely an issue w/ unpublishing workspaces and I'm surprised it went this long w/o any one seeing it. Your reproduction example was key to solving it, cheers. |
The TLDR here is that the unpublish workspaces code was written before "automatically detect workspaces" was implemented. So when you're in that directory the code that is running was intended to be ran as |
Yay! 🙏 Happy holidays. |
Current Behavior
I ran
and it would not work. The output told me I needed to add --force. I added
--force
,and this deleted the whole package, all the versions, despite having specified a version.
NPM support told me this can't be fixed. 😠😡👿
Expected Behavior
Expected behavior is npm deletes only the specified version. Big ass WTF.
https://x.com/trusktr/status/1726910009580339544?s=20
The documentation clearly says:
It does not state that
--force
ignores any specified version, which is mind blowing. 🤯I AM ANGRY!!!!!!!!!!!!!!
😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡
Is there an existing issue for this?
This issue exists in the latest npm version
Steps To Reproduce
Steps are above.
Environment
; copy and paste output from `npm config ls` here
The text was updated successfully, but these errors were encountered: