[ruby-talk:444038] package load error

Hi

I have installed "bunny" (rabbitmq client) via gem.
but this package can't be loaded. please see follows.

$ sudo gem install bunny
Successfully installed bunny-2.19.0
Parsing documentation for bunny-2.19.0
Done installing documentation for bunny after 1 seconds
1 gem installed

$ irb
irb(main):001:0> require "bunny"
<internal:/snap/ruby/290/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- bunny (LoadError)
        from <internal:/snap/ruby/290/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from (irb):1:in `<main>'
        from /snap/ruby/290/lib/ruby/gems/3.1.0/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
        from /snap/ruby/290/bin/irb:25:in `load'
        from /snap/ruby/290/bin/irb:25:in `<main>'

My ruby version is ruby 3.1.3p185.
Can you help? Thanks

···

______________________________________________
ruby-talk mailing list -- ruby-talk@ml.ruby-lang.org
To unsubscribe send an email to ruby-talk-leave@ml.ruby-lang.org
ruby-talk info -- Info | ruby-talk@ml.ruby-lang.org - ml.ruby-lang.org

And i found only root can load the package.

$ ruby -e 'require "bunny"'
<internal:/snap/ruby/290/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- bunny (LoadError)
  from <internal:/snap/ruby/290/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
  from -e:1:in `<main>'

$ sudo ruby -e 'require "bunny"'
(this works)

ruby is installed via snap on ubuntu 20.04.
how do you think of this?

Thanks

···

______________________________________________
ruby-talk mailing list -- ruby-talk@ml.ruby-lang.org
To unsubscribe send an email to ruby-talk-leave@ml.ruby-lang.org
ruby-talk info -- Info | ruby-talk@ml.ruby-lang.org - ml.ruby-lang.org

Try just "gem install bunny" without the sudo. That should install the
gem to $HOME/.gem:

  Our snap sets the GEM_HOME and GEM_PATH environment variables
  to $HOME/.gem.
  The official Ruby snap is available

I guess that sudo is not loading the snap environment so the gem is
getting installed to /var/lib/gems so is not found when run the snap
ruby under your account.

···

On 12/14/22, Henry R <support@openmbox.net> wrote:

I have installed "bunny" (rabbitmq client) via gem.
but this package can't be loaded. please see follows.

$ sudo gem install bunny
Successfully installed bunny-2.19.0

$ irb
irb(main):001:0> require "bunny"
`require': cannot load such file -- bunny (LoadError)

______________________________________________
ruby-talk mailing list -- ruby-talk@ml.ruby-lang.org
To unsubscribe send an email to ruby-talk-leave@ml.ruby-lang.org
ruby-talk info -- Info | ruby-talk@ml.ruby-lang.org - ml.ruby-lang.org

Hello, i suppose problem is with ruby snap. Try install ruby via rbenv or apt and install gem package.

-------- Исходное сообщение --------
От: Henry R support@openmbox.net
Дата: чт, 15 дек. 2022 г., 05:41
Кому: ruby-talk@ml.ruby-lang.org
Тема: [ruby-talk:444038] package load error

···

Hi

I have installed “bunny” (rabbitmq client) via gem.
but this package can’t be loaded. please see follows.

$ sudo gem install bunny
Successfully installed bunny-2.19.0
Parsing documentation for bunny-2.19.0
Done installing documentation for bunny after 1 seconds
1 gem installed

$ irb
irb(main):001:0> require “bunny”
internal:/snap/ruby/290/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb:85:in require': cannot load such file -- bunny (LoadError) from <internal:/snap/ruby/290/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in require’
from (irb):1:in <main>' from /snap/ruby/290/lib/ruby/gems/3.1.0/gems/irb-1.4.1/exe/irb:11:in <top (required)>’
from /snap/ruby/290/bin/irb:25:in load' from /snap/ruby/290/bin/irb:25:in

My ruby version is ruby 3.1.3p185.
Can you help? Thanks


ruby-talk mailing list – ruby-talk@ml.ruby-lang.org
To unsubscribe send an email to ruby-talk-leave@ml.ruby-lang.org
ruby-talk info – Info | ruby-talk@ml.ruby-lang.org - ml.ruby-lang.org