Renaming a published NPM module

前端 未结 7 2021
礼貌的吻别
礼貌的吻别 2020-12-23 11:14

Is there any way to rename an NPM module that has already been published? I want to change the name of my module to more accurately match the API it exposes but would not li

7条回答
  •  没有蜡笔的小新
    2020-12-23 11:29

    I once was in this situation. I published a package with the name bowser-or-node instead of browser-or-node.

    There's no way to rename a package, you have to deprecate and publish a new package.

    Although there's one other option. If you just published your package (less than 24 hours from time of publish) and if you're sure you're okay with deleting the package and publish a new one with the right name, you can go ahead and do it. But NPM won't allow you to delete the package once it's been 24 hours since the time of publish.

    Fortunately I figured out that I published with the wrong name in less than 20 minutes. So I just deleted and published again with a new name.

提交回复
热议问题