Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a workaround for `npm publish -f`

Now that npm publish -f is deprecated, is there a workaround or a package that makes it possible to overwrite a target version after it's been published?

I know about semver; I still want npm publish -f.

like image 268
Alexej Magura Avatar asked Jan 10 '15 06:01

Alexej Magura


People also ask

Is it free to publish NPM package?

You can publish a scoped package for free if you are logged in to npm as user 'foo'.

How do I automate an npm publish?

Automating npm tests and publishing When you're done, sign in to your Buddy workspace and do the following: Create a new project, choose GitHub as the provider, and select the forked repository. Add a new pipeline, set the trigger mode to On every push and select Master as the target branch. Add the Node.

Can anyone publish npm?

To share your code publicly in a user or organization namespace, you can publish public user-scoped or organization-scoped packages to the npm registry.


3 Answers

someone said this on npm's github issue:

@nmrony You cannot overwrite previously-published packages anymore (since February 2014, if I recall correctly).

https://github.com/npm/npm/issues/8305#issuecomment-236412989

like image 174
c0b0 Avatar answered Oct 20 '22 23:10

c0b0


You can unpublish a specific version, and then republish it:

npm unpublish [email protected]

And then republish the version.

This works indefinitely if the module is hosted on your own npm repo, but according to this, there's a time-limit (72 hours) in which you can do it if hosted on registry.npmjs.org.

like image 23
davejlin Avatar answered Oct 21 '22 00:10

davejlin


According to npm docs this unpublished versions cannot be republished,bump a patch version and publish

Once a package is unpublished, it cannot be republished. If you’ve unpublished a package by mistake, we’d recommend publishing again under a different name, or for unpublished versions, bumping the version number and publishing again.

So:

npm unpublish
npm version patch
npm publish

will do the job.

like image 9
melloc Avatar answered Oct 20 '22 23:10

melloc