每当我尝试运行gem命令时,我的控制台都会发出几个SSL错误并且无法正常执行(例如gem install xxx)。
ssl错误:
brandon@ox:~/code/quotr$ gem install bundler
Error loading RubyGems plugin "/home/brandon/.rvm/gems/ruby-2.3.1@global/gems/executable-hooks-1.3.2/lib/rubygems_plugin.rb": /home/brandon/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-linux/openssl.so: symbol SSLv2_method, version OPENSSL_1.0.0 not defined in file libssl.so.1.0.0 with link time reference - /home/brandon/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-linux/openssl.so (LoadError)
Error loading RubyGems plugin "/home/brandon/.rvm/gems/ruby-2.3.1@global/gems/gem-wrappers-1.2.7/lib/rubygems_plugin.rb": /home/brandon/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-linux/openssl.so: symbol SSLv2_method, version OPENSSL_1.0.0 not defined in file libssl.so.1.0.0 with link time reference - /home/brandon/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-linux/openssl.so (LoadError)
ERROR: Loading command: install (LoadError)
/home/brandon/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-linux/openssl.so: symbol SSLv2_method, version OPENSSL_1.0.0 not defined in file libssl.so.1.0.0 with link time reference - /home/brandon/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-linux/openssl.so
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
rvm info:
ruby-2.3.1:
system:
uname: "Linux ox 3.13.0-101-generic #148-Ubuntu SMP Thu Oct 20 22:08:32 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux"
system: "debian/jessie_sid/x86_64"
bash: "/bin/bash => GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.27.0 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "1 day 1 hour 38 minutes 21 seconds ago"
path: "/home/brandon/.rvm"
ruby:
interpreter: "ruby"
version: "2.3.1p112"
date: "2016-04-26"
platform: "x86_64-linux"
patchlevel: "2016-04-26 revision 54768"
full_version: "ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]"
homes:
gem: "/home/brandon/.rvm/gems/ruby-2.3.1"
ruby: "/home/brandon/.rvm/rubies/ruby-2.3.1"
binaries:
ruby: "/home/brandon/.rvm/rubies/ruby-2.3.1/bin/ruby"
irb: "/home/brandon/.rvm/rubies/ruby-2.3.1/bin/irb"
gem: "/home/brandon/.rvm/rubies/ruby-2.3.1/bin/gem"
rake: "/home/brandon/.rvm/rubies/ruby-2.3.1/bin/rake"
environment:
PATH: "/home/brandon/.rvm/bin:/home/brandon/gopath:/home/brandon/gopath/bin:/home/brandon/.rvm/gems/ruby-2.3.1/bin:/home/brandon/.rvm/gems/ruby-2.3.1@global/bin:/home/brandon/.rvm/rubies/ruby-2.3.1/bin:/home/brandon/gopath:/home/brandon/gopath/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/usr/local/bin/aws/bin:/home/brandon/.rvm/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/usr/local/bin/aws/bin"
GEM_HOME: "/home/brandon/.rvm/gems/ruby-2.3.1"
GEM_PATH: "/home/brandon/.rvm/gems/ruby-2.3.1:/home/brandon/.rvm/gems/ruby-2.3.1@global"
MY_RUBY_HOME: "/home/brandon/.rvm/rubies/ruby-2.3.1"
IRBRC: "/home/brandon/.rvm/rubies/ruby-2.3.1/.irbrc"
RUBYOPT: ""
gemset: ""
我甚至尝试升级到最新的openssl版本以解决这个问题,但没有骰子。
brandon@ox:~$ openssl version
OpenSSL 1.1.0c 10 Nov 2016
我的红宝石正确地指向了正确的红宝石,我已经验证了路径:
brandon@ox:~$ which ruby
/home/brandon/.rvm/rubies/ruby-2.3.1/bin/ruby
brandon@ox:~$ cd /home/brandon/.rvm/rubies/ruby-2.3.1/bin
brandon@ox:~/.rvm/rubies/ruby-2.3.1/bin$ ls
erb gem irb rake rdoc ri ruby
brandon@ox:~/.rvm/rubies/ruby-2.3.1/bin$ ls -la
total 176
drwxrwxr-x 2 brandon brandon 4096 Nov 18 13:31 .
drwxrwxr-x 6 brandon brandon 4096 Nov 18 13:31 ..
-rwxrwxr-x 1 brandon brandon 4842 Nov 18 13:31 erb
-rwxrwxr-x 1 brandon brandon 546 Nov 18 13:31 gem
-rwxrwxr-x 1 brandon brandon 190 Nov 18 13:31 irb
-rwxrwxr-x 1 brandon brandon 487 Nov 18 13:31 rake
-rwxrwxr-x 1 brandon brandon 938 Nov 18 13:31 rdoc
-rwxrwxr-x 1 brandon brandon 188 Nov 18 13:31 ri
-rwxrwxr-x 1 brandon brandon 142504 Nov 18 13:31 ruby
过去一周我一直在敲打这个问题,所以任何建议都会非常感激。我已经在这个操作系统上成功运行了几个月的ruby堆栈,但由于硬盘驱动器故障而不得不重新安装,我似乎无法解决这个问题。
有没有办法强制rvm使用不同的SSL版本?它似乎指向旧版本。
答案 0 :(得分:0)
尝试重新安装openssl。您应该完全删除旧安装。运行此命令:
apt-get autoremove && apt-get autoclean
然后,下载并编译:
wget https://www.openssl.org/source/openssl-1.1.0c.tar.gz
如果仍然无效,请尝试重新安装rvm。
rvm implode
gem uninstall rvm
rvm implode
将卸载rvm/
目录及其中构建的所有rubies。
\curl -sSL https://get.rvm.io | bash -s stable
最后,重新安装ruby:
rvm install 2.3.1
希望它有所帮助。