re-Publish to verdaccio thorws EPBULSIHCONFLICT if package already exists at npmjs

See original GitHub issue

Describe 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:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
NetOpWibbycommented, Jan 27, 2019

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: --force works 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.org for default and npm publish --registry https://site.tld for Verdaccio.

1reaction
dekadentnocommented, Feb 6, 2019

What versions of npm are you all running?? I run the latest always. 6.7 right now.

My npm is 6.7.0

BUT it dawned on me! to try adding --access restricted

TADA no more republish conflict! @dekadentno

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Best Practices - Verdaccio
Using public packages from npmjs.org​. If a package doesn't exist in the storage, the server will try to fetch it from npmjs.org. If...
Read more >
How does verdaccio work when you try to publish to a proxied ...
1 Answer 1 · Ask to the defined uplink (in case you have the proxy: npmjs in your package access`) and download the...
Read more >
verdaccio - npm
Verdaccio keeps its own small database and, if a package doesn't exist there, it asks npmjs.org for it keeping only those packages you...
Read more >
My experience publishing a package to Github's Package ...
The project I'm currently working on isn't open source so unfortunately a public npm package isn't an option and a private npm registry...
Read more >
Creating NPM Packages - BJ Anderson
If you try to publish your package with a version number that already exists in your npm repo, the publish command will fail....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found