无法安装 Ruby Gems 3.0.3

Unable to install Ruby Gems 3.0.3

由于 Logstash 的依赖性错误,我正在尝试通过 RVM 在 Raspberry Pi 上重新安装 Ruby 1.9.3,并出现以下错误。其他人也有类似的问题:

ruby-1.9.3-p551 - #downloading ruby-1.9.3-p551, this may take a while depending on your connection...
ruby-1.9.3-p551 - #extracting ruby-1.9.3-p551 to /home/pi/.rvm/src/ruby-1.9.3-p551.....
ruby-1.9.3-p551 - #applying patch /home/pi/.rvm/patches/ruby/GH-488.patch.
ruby-1.9.3-p551 - #applying patch /home/pi/.rvm/patches/ruby/1.9.3/CVE-2015-1855-p484.patch.
ruby-1.9.3-p551 - #applying patch /home/pi/.rvm/patches/ruby/1.9.3/update-autoconf.patch.
ruby-1.9.3-p551 - #applying patch /home/pi/.rvm/patches/ruby/1.9.3/openssl3.patch.
ruby-1.9.3-p551 - #configuring..............................................
ruby-1.9.3-p551 - #post-configuration..
ruby-1.9.3-p551 - #compiling..........................................................................................................................................................................
ruby-1.9.3-p551 - #installing........................
ruby-1.9.3-p551 - #making binaries executable..
ruby-1.9.3-p551 - #downloading rubygems-3.0.3
ruby-1.9.3-p551 - #extracting rubygems-3.0.3......
ruby-1.9.3-p551 - #removing old rubygems........
ruby-1.9.3-p551 - #installing rubygems-3.0.3..
Error running 'env GEM_HOME=/home/pi/.rvm/gems/ruby-1.9.3-p551@global GEM_PATH= /home/pi/.rvm/rubies/ruby-1.9.3-p551/bin/ruby -d /home/pi/.rvm/src/rubygems-3.0.3/setup.rb --no-document',
please read /home/pi/.rvm/log/1555769993_ruby-1.9.3-p551/rubygems.install.log

日志文件错误:

command(7): env GEM_HOME=/home/pi/.rvm/gems/ruby-1.9.3-p551@global GEM_PATH= /home/pi/.rvm/rubies/ruby-1.9.3-p551/bin/ruby -d /home/pi/.rvm/src/rubygems-3.0.3/setup.rb --no-document
Exception `LoadError' at /home/pi/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/rubygems.rb:1264 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /home/pi/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/rubygems.rb:1273 - cannot load such file -- rubygems/defaults/ruby
/home/pi/.rvm/src/rubygems-3.0.3/lib/rubygems/core_ext/kernel_require.rb:54:in `require': /home/pi/.rvm/src/rubygems-3.0.3/lib/rubygems/core_ext/kernel_warn.rb:15: syntax error, unexpected tLABEL (SyntaxError)
    module_function define_method(:warn) {|*messages, uplevel: nil|
                                                              ^
/home/pi/.rvm/src/rubygems-3.0.3/lib/rubygems/core_ext/kernel_warn.rb:18: void value expression
/home/pi/.rvm/src/rubygems-3.0.3/lib/rubygems/core_ext/kernel_warn.rb:43: syntax error, unexpected '}', expecting keyword_end
        from /home/pi/.rvm/src/rubygems-3.0.3/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /home/pi/.rvm/src/rubygems-3.0.3/lib/rubygems.rb:1395:in `<top (required)>'
        from setup.rb:28:in `require'
        from setup.rb:28:in `<main>'

有什么建议吗?我不太熟悉 Ruby 或 RVM,因此不胜感激。

Ruby 1.9.3-p551 于 2014 年 11 月发布,此时可能与最新的 ruby​​gems 不兼容。

尝试安装旧版本的 rubygems,我会从 2.4.4 开始,因为它与 Ruby 1.9.3 的版本非常吻合,但我也会尝试升级到任何 2.X 因为人们应该期望支持会持续几年。

该项目的 changelog 确实提到删除了 1.9.2 的兼容性代码。

在同一问题上 运行。您需要将 ruby gem 版本更改为 2.7.3 默认为 3.0.8

  • rvm_rubygems_version=2.7.3 rvm 重新安装ruby-1.9.3

对我有用

对我有用的是降级到旧版本的 rvm。

curl -sSL https://get.rvm.io | bash -s 1.28.0