Skip to content

[BUG] npm unpublish should warn about mandatory 24-hour waiting period #958

@broofa

Description

@broofa

Okay, arguments about the wisdom of allowing modules to be unpublished aside, I recently found myself wanting to "republish" a new module I'd created (persistentmap) by npm unpublish'ing it, making a couple edits, then npm publishing it under the same version. (I know, I know... I wanted to just tweak a few things in the README. Shoot me.)

Aside from the expected warning about needing to use --force, the unpublish action worked fine. However when I went to republish it, I was a met with the following:

$ npm publish
[... snip ...]
npm ERR! 403 403 Forbidden - PUT https://registry.npmjs.org/persistentmap - persistentmap cannot be republished until 24 hours have passed.

I'm sure there are good and valid reasons for this waiting period - I'm not arguing that - but to not have any warning about it was an unpleasant shock. In my case this isn't a big deal - nobody is using persistentmap yet so, fine whatever, but this could have been problematic had I decided to try this with a package that had dependents.

(Again, let's assume for the moment that most NPM users are, like me, willing to do stupid things they probably shouldn't be doing in the first place.)

It would have been nice to have had a warning about this. E.g.

$ npm --force unpublish
**Warning**: Unpublished packages may not be republished for 24 hours.
Type (Y)es to proceed: _

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingRelease 7.xwork is associated with a specific npm 7 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions