npm publish release package error code: ERR400

problem background

See the third point for the solution
The blogger encountered the following error when publishing the npm publish operation of the package:

npm ERR! code E400
npm ERR! 400 Bad Request - PUT https://registry.npmjs.org/xxx - Cannot publish over previously published version "1.0.0".        

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\xxx\AppData\Roaming\npm-cache\_logs\2022-07-28T09_38_58_224Z-debug.log

Error reason

Because the error message Cannot publish over previously published version “1.0.0”. means “cannot publish on the previously released version “1.0.0”.”, which means that the current version already exists and cannot be published repeatedly. You can modify the last two digits of the version number and increase the version number to solve it.

Solution (pro-test is effective)

step:
1. Open the package.json file of the package
2. Modify the value of the version number version

insert image description here
3. Perform the npm publish operation in the terminal again to complete
insert image description here

other problems

After publishing, I found that the package page displayed 1 package on the homepage of npm itself, but I couldn’t see the package and it was blank. I also encountered this problem. My solution to this problem is: modify the version number again, and then npm publish again, and you can see it. It has been successfully resolved, a reference for everyone who encounters the same problem.
insert image description here

Guess you like

Origin blog.csdn.net/dxy1128/article/details/126063539