Home > Software engineering >  Publish 'older' version of package?
Publish 'older' version of package?

Time:05-26

I published a major version of a package on npm but I am now realizing that it should've been only a minor update. The recently published version is 2.0.0, before I published it was 1.3.0. Is there a way to go back and publish version 1.4.0 now? Thanks!

CodePudding user response:

Refer to the npm Unpublish Policy.

If your version 2.0.0 was published less than 72 hours ago, and no other packages in the npm Public Registry depend on version 2.0.0 of your package, then consider performing the following steps:

  1. Run the following command to unpublished version 2.0.0:
    npm unpublish <package_name>@2.0.0
    
  2. Then publish your 1.4.0 version.

Also note that in the Considerations section it states:

Once package@version has been used, you can never use it again. You must publish a new version even if you unpublished the old one.

This will mean that when you do want to publish the next major update, i.e. version 2.0.0, you are not allowed, therefore you’ll have to publish it as 2.0.1 instead.

  •  Tags:  
  • npm
  • Related