如何在 shell 启动期间修复此加载错误?

How do I fix this load error during shell start?

每当我启动 shell 时,我都会收到一个错误,说它无法加载 gem,奇怪的是 ubygems(注意缺少 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

这是 asdf 的问题还是其他问题?

该功能(ubygems.rb) was removed in ruby 2.5: https://github.com/rubygems/rubygems/issues/2393

它用于从命令行执行 require "rubygems",如下所示:

ruby -rubygems ...

注意-rubygems中的"r"是一个flag,意思是"require"。 "ubygems" 是它所需要的东西。默认情况下未加载 rubygems 时需要它。但现在它们是,所以该功能不再有意义了。

您应该更改打开 shell 的命令。或者在2.5

之前切换到ruby