[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

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

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)
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. https://www.ruby-lang.org/en/news/2018/11/08/snap/ 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.
participants (3)
-
anton.shchankin@yandex.ru
-
Frank J. Cameron
-
Henry R