Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

You cannot publish over the previously published versions

I've updated my package using npm version minor to go from 0.4.0 to 0.5.0, and both package.json and package-lock.json reflect this. However when I run the npm publish command it says:

You cannot publish over the previously published versions: 0.4.0

Is there another place I need to update the semver in order to publish?

like image 589
user1795832 Avatar asked Dec 11 '18 20:12

user1795832


4 Answers

This helped me:

Open Command Prompt and do the following steps.

  1. npm version <new_Version_No>
  2. npm publish
like image 111
Adrita Sharma Avatar answered Oct 17 '22 01:10

Adrita Sharma


In your package.json, there might exist a publish script command with content of npm publish ..., remove or rename the publish command in your scripts of package.json if there is one.

Take the following code for example, this scripts.publish command will again be triggered by npm publish --access public, running recursively.

"scripts": {
 "publish": "npm publish --access public" // this was being triggered by running `npm publish`
},
like image 12
Iceberg Avatar answered Oct 17 '22 01:10

Iceberg


take a look at your package.json. Is the version actually set to 0.5.0? If not consider setting it manually there. NPM is telling you that you already have a version 0.4.0 and it cannot publish it again. So it seems to think that it's still on 0.4.0.

like image 9
MarvinJWendt Avatar answered Oct 17 '22 03:10

MarvinJWendt


npm version [patch|minor|major|<version_no>] should be done to bump up the version and then

npm publish for public visibility add --access public

This should do it.

like image 4
Mukul Anand Avatar answered Oct 17 '22 03:10

Mukul Anand