全新安装Rails并获取OpenSSL错误:“已初始化常量OpenSSL”

时间:2017-02-02 03:02:13

标签: ruby-on-rails ruby rvm

我被困在试图继续使用RoR。我做了Ruby Installfest,但遇到了我认为是openssl.bundle的问题。

我正在使用RVM,并且正在运行Rails 5.0.1和Ruby 2.4.0

我尝试使用rvm implode完全删除/重新开始,然后重新安装RailsApps Guide之后的所有内容,但仍然看到相同的错误。我正在运行最新版本的macOS Sierra。

这是我在my_app中运行$ Rake -T时得到的输出。

richsmith@Richs-MacBook-Pro:~/workspace/myapp$ rake -T
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle: warning: already initialized constant OpenSSL::VERSION
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_VERSION
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_LIBRARY_VERSION
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_VERSION_NUMBER
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_FIPS
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle: warning: already initialized constant OpenSSL::Config::DEFAULT_CONFIG_FILE
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle: warning: already initialized constant OpenSSL::PKCS7::Signer
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle: warning: already initialized constant OpenSSL::PKCS7::TEXT
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle: warning: already initialized constant OpenSSL::PKCS7::NOCERTS
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle: warning: already initialized constant OpenSSL::PKCS7::NOSIGS
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle: warning: already initialized constant OpenSSL::PKCS7::NOCHAIN
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle: warning: already initialized constant OpenSSL::PKCS7::NOINTERN
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle: warning: already initialized constant OpenSSL::PKCS7::NOVERIFY
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle: warning: already initialized constant OpenSSL::PKCS7::DETACHED
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle: warning: already initialized constant OpenSSL::PKCS7::BINARY
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle: warning: already initialized constant OpenSSL::PKCS7::NOATTR
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle: warning: already initialized constant OpenSSL::PKCS7::NOSMIMECAP
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle: warning: already initialized constant OpenSSL::ASN1::UNIVERSALSTRING
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle: warning: already initialized constant OpenSSL::ASN1::CHARACTER_STRING
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle: warning: already initialized constant OpenSSL::ASN1::BMPSTRING
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/pkey.rb:8: warning: already initialized constant OpenSSL::PKey::DH::DEFAULT_1024
/Users/richsmith/.rvm/gems/ruby-2.4.0@global/gems/openssl-2.0.3/lib/openssl/pkey.rb:8: warning: previous definition of DEFAULT_1024 was here
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/pkey.rb:17: warning: already initialized constant OpenSSL::PKey::DH::DEFAULT_2048
/Users/richsmith/.rvm/gems/ruby-2.4.0@global/gems/openssl-2.0.3/lib/openssl/pkey.rb:17: warning: previous definition of DEFAULT_2048 was here
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/pkey.rb:30: warning: already initialized constant OpenSSL::PKey::DEFAULT_TMP_DH_CALLBACK
/Users/richsmith/.rvm/gems/ruby-2.4.0@global/gems/openssl-2.0.3/lib/openssl/pkey.rb:30: warning: previous definition of DEFAULT_TMP_DH_CALLBACK was here
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/cipher.rb:18: warning: constant OpenSSL::Cipher::Cipher is deprecated
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/cipher.rb:24: warning: already initialized constant OpenSSL::Cipher::AES
/Users/richsmith/.rvm/gems/ruby-2.4.0@global/gems/openssl-2.0.3/lib/openssl/cipher.rb:24: warning: previous definition of AES was here
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/cipher.rb:18: warning: constant OpenSSL::Cipher::Cipher is deprecated
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/cipher.rb:24: warning: already initialized constant OpenSSL::Cipher::CAST5
/Users/richsmith/.rvm/gems/ruby-2.4.0@global/gems/openssl-2.0.3/lib/openssl/cipher.rb:24: warning: previous definition of CAST5 was here
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/cipher.rb:18: warning: constant OpenSSL::Cipher::Cipher is deprecated
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/cipher.rb:24: warning: already initialized constant OpenSSL::Cipher::BF
/Users/richsmith/.rvm/gems/ruby-2.4.0@global/gems/openssl-2.0.3/lib/openssl/cipher.rb:24: warning: previous definition of BF was here
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/cipher.rb:18: warning: constant OpenSSL::Cipher::Cipher is deprecated
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/cipher.rb:24: warning: already initialized constant OpenSSL::Cipher::DES
/Users/richsmith/.rvm/gems/ruby-2.4.0@global/gems/openssl-2.0.3/lib/openssl/cipher.rb:24: warning: previous definition of DES was here
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/cipher.rb:18: warning: constant OpenSSL::Cipher::Cipher is deprecated
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/cipher.rb:24: warning: already initialized constant OpenSSL::Cipher::IDEA
/Users/richsmith/.rvm/gems/ruby-2.4.0@global/gems/openssl-2.0.3/lib/openssl/cipher.rb:24: warning: previous definition of IDEA was here
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/cipher.rb:18: warning: constant OpenSSL::Cipher::Cipher is deprecated
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/cipher.rb:24: warning: already initialized constant OpenSSL::Cipher::RC2
/Users/richsmith/.rvm/gems/ruby-2.4.0@global/gems/openssl-2.0.3/lib/openssl/cipher.rb:24: warning: previous definition of RC2 was here
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/cipher.rb:18: warning: constant OpenSSL::Cipher::Cipher is deprecated
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/cipher.rb:24: warning: already initialized constant OpenSSL::Cipher::RC4
/Users/richsmith/.rvm/gems/ruby-2.4.0@global/gems/openssl-2.0.3/lib/openssl/cipher.rb:24: warning: previous definition of RC4 was here
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/cipher.rb:18: warning: constant OpenSSL::Cipher::Cipher is deprecated
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/cipher.rb:24: warning: already initialized constant OpenSSL::Cipher::RC5
/Users/richsmith/.rvm/gems/ruby-2.4.0@global/gems/openssl-2.0.3/lib/openssl/cipher.rb:24: warning: previous definition of RC5 was here
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/cipher.rb:28: warning: constant OpenSSL::Cipher::Cipher is deprecated
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/cipher.rb:33: warning: already initialized constant OpenSSL::Cipher::AES128
/Users/richsmith/.rvm/gems/ruby-2.4.0@global/gems/openssl-2.0.3/lib/openssl/cipher.rb:33: warning: previous definition of AES128 was here
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/cipher.rb:28: warning: constant OpenSSL::Cipher::Cipher is deprecated
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/cipher.rb:33: warning: already initialized constant OpenSSL::Cipher::AES192
/Users/richsmith/.rvm/gems/ruby-2.4.0@global/gems/openssl-2.0.3/lib/openssl/cipher.rb:33: warning: previous definition of AES192 was here
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/cipher.rb:28: warning: constant OpenSSL::Cipher::Cipher is deprecated
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/cipher.rb:33: warning: already initialized constant OpenSSL::Cipher::AES256
/Users/richsmith/.rvm/gems/ruby-2.4.0@global/gems/openssl-2.0.3/lib/openssl/cipher.rb:33: warning: previous definition of AES256 was here
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/cipher.rb:64: warning: constant OpenSSL::Cipher::Cipher is deprecated
/Users/richsmith/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/openssl/cipher.rb:64: warning: constant OpenSSL::Cipher::Cipher is deprecated
rake aborted!
TypeError: superclass mismatch for class Cipher
/Users/richsmith/.rvm/gems/ruby-2.4.0@global/gems/activesupport-5.0.1/lib/active_support/key_generator.rb:2:in `require'
/Users/richsmith/.rvm/gems/ruby-2.4.0@global/gems/activesupport-5.0.1/lib/active_support/key_generator.rb:2:in `<top (required)>'
/Users/richsmith/.rvm/gems/ruby-2.4.0@global/gems/railties-5.0.1/lib/rails/application.rb:4:in `require'
/Users/richsmith/.rvm/gems/ruby-2.4.0@global/gems/railties-5.0.1/lib/rails/application.rb:4:in `<top (required)>'
/Users/richsmith/.rvm/gems/ruby-2.4.0@global/gems/railties-5.0.1/lib/rails.rb:11:in `require'
/Users/richsmith/.rvm/gems/ruby-2.4.0@global/gems/railties-5.0.1/lib/rails.rb:11:in `<top (required)>'
/Users/richsmith/.rvm/gems/ruby-2.4.0@global/gems/railties-5.0.1/lib/rails/all.rb:1:in `require'
/Users/richsmith/.rvm/gems/ruby-2.4.0@global/gems/railties-5.0.1/lib/rails/all.rb:1:in `<top (required)>'
/Users/richsmith/workspace/myapp/config/application.rb:3:in `require'
/Users/richsmith/workspace/myapp/config/application.rb:3:in `<top (required)>'
/Users/richsmith/workspace/myapp/Rakefile:4:in `require_relative'
/Users/richsmith/workspace/myapp/Rakefile:4:in `<top (required)>'
/Users/richsmith/.rvm/gems/ruby-2.4.0@global/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)

3 个答案:

答案 0 :(得分:18)

gem uninstall openssl -v 2.0.3

gem install openssl -v 2.0.2

那应该解决它。

答案 1 :(得分:8)

我通过添加以下行解决了这个问题:

gem&#39; openssl&#39;,&#39;&gt; = 2.0.3&#39;

到我的gemfile。显然,bundler正在加载默认的2.0.2版本以及新的2.0.3版本。上面的一行阻止了这一点。

答案 2 :(得分:5)

3小时后解决了这个问题。问题在日志文件中很明显,openSSL发生了一些愚蠢的事情。

解决方案是:

  1. 删除问题的所有痕迹rvm implode

  2. 从那里我使用$ \curl -L https://get.rvm.io | bash -s stable

  3. 重新安装了rvm
  4. 关闭并重新打开终端。

  5. 已安装的Ruby $ rvm install ruby-2.4.0
  6. 更新了gem manager $ gem update --system
  7. 使用$ rvm gemset use global
  8. 更改为全局gemset
  9. 然后使用$ gem update
  10. 更新了所有宝石
  11. 从这里我使用$ gem install bundlergem install nokogiri
  12. 安装了bundler和Nokogiri(不确定它是否是openSSL的依赖,但没有抓住机会)
  13. 从这里开始我使用$ rvm use ruby-2.4.0@rails5.0 --create
  14. 创建了一个新的gemset来安装rails
  15. 然后我使用$ gem install rails
  16. 安装了最新版本的rails
  17. 此时不想冒险,我使用gem uninstall openssl
  18. 删除了openSSL
  19. 然后使用gem install openssl
  20. 重新安装
  21. 最后,我关闭了我的终端,重新打开它,瞧,它工作了!
  22. 我对此非常陌生,所以肯定会有裁员,但我知道这个解决方案清理了一切并且工作正常。