Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm cannot publish over previously published version

npm is causing me grief and I have no idea why. Trying to publish a new version of my package.

npm view {{package}} versions

[ '0.3.0',
  '0.3.1',
  '0.4.0',
  '0.4.2',
  '0.5.0',
  '0.6.0',
  '0.6.1',
  '0.7.0',
  '0.7.1',
  '0.8.0',
  '0.8.1',
  '0.8.2',
  '0.8.3',
  '0.8.4',
  '0.8.5' ]

When I run npm publish I get this:

400 Bad Request - PUT https://registry.npmjs.org/{{package}} - Cannot publish over previously published version "1.0.0".

This is my current package.json:

...
"version": "1.0.0",
...

What gives?

EDIT:

Further, even when I try to patch the version and publish a 1.0.1 or a 1.0.2 I get the same message....good grief...

like image 759
Adam Avatar asked Nov 30 '22 21:11

Adam


1 Answers

So when I was first creating my package a few months ago, I had originally published a 1.0, decided I didn't like it and unpublished it from the registry. I had forgotten I had done this and, due to NPMs policies, which I support, they don't allow you to republish a version of a package that had previously been published. Had to version bump to 1.0.3 in order to get it to work. Might help somebody else out.

EDIT: The npm view command (with the --json flag) can give you some insight into what's happened. It'll output something like this close to the top

  "time": {
    "created": "2020-06-09T19:57:19.446Z",
    "1.0.0": "2020-06-09T19:57:19.720Z",
    "modified": "2020-08-23T21:31:17.255Z",
    "1.0.1": "2020-06-09T23:32:53.322Z",
    "2.0.0": "2020-06-10T12:49:09.722Z",
    "2.0.1": "2020-06-10T13:17:40.021Z",
    "2.0.2": "2020-06-10T19:37:09.994Z",
    "2.0.3": "2020-06-11T00:24:46.982Z",
    "2.0.4": "2020-08-20T21:18:46.305Z",
    "2.0.5": "2020-08-20T21:20:42.971Z",
    "2.0.6": "2020-08-20T21:35:22.181Z",
    "2.0.7": "2020-08-20T22:30:24.183Z",
    "2.0.8": "2020-08-20T22:42:05.255Z",
    "2.0.9": "2020-08-23T21:31:15.021Z"
  },
like image 61
Adam Avatar answered Dec 04 '22 04:12

Adam