ruby-progressbar icon indicating copy to clipboard operation
ruby-progressbar copied to clipboard

cannot load such file -- enumerator (LoadError)

Open luk4s opened this issue 3 years ago • 1 comments

ruby-progressbar in combination with others gems requiring enumerator.rb file cause error

cannot load such file -- enumerator (LoadError)

if they are loaded in specify order.

Steps to Reproduce

In our application we have several dependencies

  • https://rubygems.org/gems/ruby-msg
  • https://rubygems.org/gems/roo-xls which require "enumerator" for some reasons.

One of our gem require "ruby-progressbar" and by accident its named is alphabetically before ruby-msg. Application is not able to start because error cannot load such file -- enumerator (LoadError) on ruby 3+ (tested, but I think 2.7+, because https://bugs.ruby-lang.org/issues/10902)

Expected Behavior

luk4s avatar May 24 '22 09:05 luk4s

@luk4s I'm going to need a sample program to reproduce this. There is no reason why calling require "enumerator" should load the refinement from this library. The only thing that would load this refinement is require "ruby-progressbar/refinements/enumerator". That file is not even loaded by default and must be called explicitly.

jfelchner avatar Jun 20 '22 20:06 jfelchner

I now know what's going on here. I'm closing this in favor of the PR.

jfelchner avatar Feb 26 '23 17:02 jfelchner

Hi @jfelchner I prepared for you copy of our application with additional gems which cause it this order error, check our repo pls. https://git.easy.cz/redmine/package/-/tree/progressbar_test_enumerator

luk4s avatar Feb 27 '23 11:02 luk4s

@luk4s can we get a smaller reproduction case that I can put into a test? Seems like this should be reproducible in like 4 or 5 lines of code.

jfelchner avatar Mar 01 '23 16:03 jfelchner

@luk4s I released 1.13.0rc1. You will have to explicitly require it in your app because it's a non-stable version (gem 'ruby-progressbar', '~> 1.13.0rc1')

Please let me know if this resolves the issue.

jfelchner avatar Mar 01 '23 19:03 jfelchner

✅ I can confirm that v1.13.0rc1 works - it did not cause "enumerator error" 👍 good job

Thank you

luk4s avatar Mar 01 '23 19:03 luk4s

Thank you! ❤️

jfelchner avatar Mar 01 '23 20:03 jfelchner