Newbie question about local gems vs. system installed ruby


I receive following annoying warnings in my environment. I am using manjaro
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]. I deleted local .gem reporsitory and call gem update and recreate the .gem. The problem continues. I do not understand why I receive these warnings? Because of update? Then how can I prevent it and tell gem to use the updated packages?

Any help much appreciated?

/usr/lib/ruby/2.7.0/uri/version.rb:3: warning: already initialized constant URI::VERSION_CODE
/home/toktay/.gem/ruby/2.7.0/gems/uri-0.10.1/lib/uri/version.rb:3: warning: previous definition of VERSION_CODE was here

This warning says the library you are using already reinitialize constant. You can’t do much about it. No matter if you use local gem or not. But yes, if you downgrade or upgrade the gem, the warning may go away.

To suppress warnings in IRB, launch the IRB as:

$ irb -W0


$ RUBYOPT=-W0 irb

Or you can type this in the IRB:

irb(main):001:0> $-v = nil

Yes, $-v = nil or alternatively $VERBOSE = nil.

But to make the change persistent, you can add options to IRB by utilizing the .irbrc file:

# ~/.irbrc

$-v = nil

These are the ways you can disable warnings. Sometimes warnings can be really helpful. But you can’t do anything without either disabling the warning, or let it be fixed by the gem developer or by fixing the gem yourself!

Currently my situation is kind of similar. When I run irb, I get:

/usr/lib/ruby/gems/2.7.0/gems/reline-0.2.0/lib/reline.rb:365: warning: instance variable @ambiguous_width not initialized

But I safely ignore this warning!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs