re-Publish to verdaccio thorws EPBULSIHCONFLICT if package already exists at npmjs
See original GitHub issueDescribe the bug
When publishing to verdaccio a package for the first time (like when u have a new verdaccio install/storage) if that package already exists in npmjs npm will throw an error
npm ERR! code EPUBLISHCONFLICT
npm ERR! publish fail Cannot publish over existing version.
like here I have my scoped packages at npmjs https://www.npmjs.com/org/uci and if I try to publish any of these to a clean verdaccio I get the conflict.
To Reproduce
publish a package to npmjs npm publish --registry https://registry.npmjs.org --access public
now do a fresh install, or scrub the /storage folder and re add a user.
now npm publish --registry http://localhost:4873'
The tarball is copied to storage fine but no entry is made in db.json file and in the log you get the EPUBLISHCONFLICT error
now edit config.yaml and remove proxy: npmjs from the packages: section and the issue goes away.
Expected behavior
Verdaccio shouldn’t check/proxy through to npmjs at all when using npm publish --registry http://localhost:4873' That being the whole point right? If I publish to or ask for a repo and verdaccio is handling it then it should ignore npmjs all together. See below cause it’s maybe not doing that but throwning a stream write error that makes it look so.
Versions I tried various versions including 4.0 beta and This happens for any version going back ❤️.0 via docker or via global install.
check out #questions at discord for my many posts tracking this down.
NOTE if you do use npm publish --registry http://localhost:4873 --force you can get verdaccio/npm to accept the publish without error. But that’s not a solution as I need it to proxy other packages.
below you see log from vercaddio when first I publish. the first publish throws a stream error which is probably the real issue which then elicits the confusing EPUBLISHCONFLICT in npm.
http <-- 409, user: david(127.0.0.1), req: 'PUT /@uci%2fi2c-device', error: this package is already present
http <-- 409, user: david(127.0.0.1), req: 'PUT /@uci%2fi2c-device', error: this package is already present
http <-- 200, user: david(127.0.0.1), req: 'GET /@uci%2fi2c-device?write=true', bytes: 0/2956
http <-- 200, user: david(127.0.0.1), req: 'GET /@uci%2fi2c-device?write=true', bytes: 0/2956
http <-- 409, user: david(127.0.0.1), req: 'PUT /@uci%2fi2c-device', error: this package is already present
http <-- 409, user: david(127.0.0.1), req: 'PUT /@uci%2fi2c-device', error: this package is already present
Error [ERR_STREAM_WRITE_AFTER_END]: write after end
at writeAfterEnd (_stream_writable.js:248:12)
at WriteStream.Writable.write (_stream_writable.js:296:5)
at UploadTarball.ondata (_stream_readable.js:693:20)
at UploadTarball.emit (events.js:188:13)
at UploadTarball.Readable.read (_stream_readable.js:491:10)
at flow (_stream_readable.js:957:34)
at resume_ (_stream_readable.js:938:3)
at processTicksAndRejections (internal/process/next_tick.js:76:17)
Error: ENOENT: no such file or directory, rename '/home/david/.local/share/verdaccio/storage/@uci/i2c-device/i2c-device-0.1.4.tgz.tmp-0420165471909848' -> '/home/david/.local/share/verdaccio/storage/@uci/i2c-device/i2c-device-0.1.4.tgz'
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:10 (1 by maintainers)
Top Related StackOverflow Question
I’m running into this issue as well. I don’t like having to needlessly version bump just to get this to work.
EDIT: Like OP, I just installed Verdaccio and I ran into this issue with my first publish. EDIT 2:
--forceworks but I wish I didn’t have to do it. EDIT 3: Specifying the registry works without the usage of--force. So,npm publish --registry https://registry.npmjs.orgfor default andnpm publish --registry https://site.tldfor Verdaccio.My npm is 6.7.0
Good catch there, thank you very much. I can confirm that this solution is working so far, but I’ve tested it only on 3-4 packages. I’ll analyze your solution more thoroughly asap.
But then again, I’ve never found a logical link between packages that didn’t make any problems when publishing and those packages that were giving our famous EPUBLISHCONFLICT issue.
Thanks for your answer, once again @dkebler