无法安装Ruby Gems 3.0.3

时间:2019-04-21 12:54:36

标签: ruby rubygems runtime-error runtime rvm

由于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并不是很熟悉,因此可以提供任何帮助。

3 个答案:

答案 0 :(得分:2)

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

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

对我有用

答案 1 :(得分:1)

Ruby 1.9.3-p551于2014年11月发布,目前的兼容性可能与最新的rubygems无关。

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

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

答案 2 :(得分:0)

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

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