rubyshellzshrcasdf-vm

How do I fix this load error during shell start?


Whenever I start the shell I get an error from it saying that it could not load a gem, curiously named ubygems (notice the lack of r).

➜ reload                       
Traceback (most recent call last):
    1: from /home/ux/.asdf/installs/ruby/2.5.5/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/home/ux/.asdf/installs/ruby/2.5.5/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- ubygems (LoadError)

 * keychain 2.8.2 ~ http://www.funtoo.org
 * Found existing ssh-agent: 6895
 * Known ssh key: /home/ux/.ssh/id_rsa

Startup time: 623610 ms

Is this an issue with asdf or could it be something else?


Solution

  • That feature (ubygems.rb) was removed in ruby 2.5: https://github.com/rubygems/rubygems/issues/2393

    It was used to do a require "rubygems" from command-line, like this:

    ruby -rubygems ...
    

    Note that the "r" in -rubygems is a flag, meaning "require". And "ubygems" is the thing it requires. It was needed when rubygems weren't loaded by default. But now they are, so the feature doesn't make sense anymore.

    You should change the command that opens the shell. Or switch to ruby before 2.5