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

时间:2021-03-05 07:15:21

I am stuck trying to get going with RoR. I did the Ruby Installfest, but am running into an issue with what I think is openssl.bundle.

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

I am using RVM, and am running Rails 5.0.1 and Ruby 2.4.0

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

I tried a full removal/fresh start by using rvm implode and went through and reinstalled everything following RailsApps Guide but am still seeing the identical error. I am running the latest version of macOS Sierra.

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

This is the output I get when running $Rake -T in my_app.

这是我在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 个解决方案

#1


18  

gem uninstall openssl -v 2.0.3

gem uninstall openssl -v 2.0.3

gem install openssl -v 2.0.2

gem install openssl -v 2.0.2

That should fix it.

那应该解决它。

#2


8  

I solved this by adding the line:

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

gem 'openssl', '>=2.0.3'

宝石'openssl','> = 2.0.3'

to my gemfile. Apparently bundler is loading both the default 2.0.2 version as well as the new 2.0.3 version. The line above prevents this.

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

#3


5  

Solved this 3 hours later. The issue was as apparent in the log files, something goofy happened to openSSL.

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

The solution was to:

解决方案是:

  1. Remove all traces of the issue rvm implode

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

  2. From there I did a fresh install of rvm using $ \curl -L https://get.rvm.io | bash -s stable

    从那里我使用$ \ curl -L https://get.rvm.io |进行了全新的rvm安装bash -s稳定

  3. Closed and reopened the terminal.

    关闭并重新打开终端。

  4. Installed Ruby $ rvm install ruby-2.4.0
  5. 安装Ruby $ rvm安装ruby-2.4.0
  6. Updated the gem manager $ gem update --system
  7. 更新了gem manager $ gem update --system
  8. Changed to the global gemset using $ rvm gemset use global
  9. 使用$ rvm gemset使用global更改为全局gemset
  10. Then updated all gems using $ gem update
  11. 然后使用$ gem update更新所有宝石
  12. From here I installed bundler and Nokogiri (not sure if it is a dependent for openSSL but wasn't taking chances) using $ gem install bundler and gem install nokogiri
  13. 从这里我安装了bundler和Nokogiri(不确定它是否是openSSL的依赖,但没有冒险)使用$ gem install bundler和gem install nokogiri
  14. From here I made a new gemset to install rails in using $ rvm use ruby-2.4.0@rails5.0 --create
  15. 从这里开始使用$ rvm使用ruby-2.4.0@rails5.0创建一个新的gemset来安装rails --create
  16. Then I installed the latest version of rails using $ gem install rails
  17. 然后我使用$ gem install rails安装了最新版本的rails
  18. Not wanting to take chances at this point, I removed openSSL using gem uninstall openssl
  19. 我不想在这一点上抓住机会,我使用gem uninstall openssl删除了openSSL
  20. Then reinstalled it with gem install openssl
  21. 然后用gem install openssl重新安装它
  22. Lastly, I closed my terminal, reopened it and voila, it worked!
  23. 最后,我关闭了我的终端,重新打开它,瞧,它工作了!

I am very new to this so there may be redundancies here for sure, but I know this solution cleaned everything up and worked.

我对此非常陌生,所以肯定会有裁员,但我知道这个解决方案清理了一切并且工作正常。

#1


18  

gem uninstall openssl -v 2.0.3

gem uninstall openssl -v 2.0.3

gem install openssl -v 2.0.2

gem install openssl -v 2.0.2

That should fix it.

那应该解决它。

#2


8  

I solved this by adding the line:

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

gem 'openssl', '>=2.0.3'

宝石'openssl','> = 2.0.3'

to my gemfile. Apparently bundler is loading both the default 2.0.2 version as well as the new 2.0.3 version. The line above prevents this.

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

#3


5  

Solved this 3 hours later. The issue was as apparent in the log files, something goofy happened to openSSL.

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

The solution was to:

解决方案是:

  1. Remove all traces of the issue rvm implode

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

  2. From there I did a fresh install of rvm using $ \curl -L https://get.rvm.io | bash -s stable

    从那里我使用$ \ curl -L https://get.rvm.io |进行了全新的rvm安装bash -s稳定

  3. Closed and reopened the terminal.

    关闭并重新打开终端。

  4. Installed Ruby $ rvm install ruby-2.4.0
  5. 安装Ruby $ rvm安装ruby-2.4.0
  6. Updated the gem manager $ gem update --system
  7. 更新了gem manager $ gem update --system
  8. Changed to the global gemset using $ rvm gemset use global
  9. 使用$ rvm gemset使用global更改为全局gemset
  10. Then updated all gems using $ gem update
  11. 然后使用$ gem update更新所有宝石
  12. From here I installed bundler and Nokogiri (not sure if it is a dependent for openSSL but wasn't taking chances) using $ gem install bundler and gem install nokogiri
  13. 从这里我安装了bundler和Nokogiri(不确定它是否是openSSL的依赖,但没有冒险)使用$ gem install bundler和gem install nokogiri
  14. From here I made a new gemset to install rails in using $ rvm use ruby-2.4.0@rails5.0 --create
  15. 从这里开始使用$ rvm使用ruby-2.4.0@rails5.0创建一个新的gemset来安装rails --create
  16. Then I installed the latest version of rails using $ gem install rails
  17. 然后我使用$ gem install rails安装了最新版本的rails
  18. Not wanting to take chances at this point, I removed openSSL using gem uninstall openssl
  19. 我不想在这一点上抓住机会,我使用gem uninstall openssl删除了openSSL
  20. Then reinstalled it with gem install openssl
  21. 然后用gem install openssl重新安装它
  22. Lastly, I closed my terminal, reopened it and voila, it worked!
  23. 最后,我关闭了我的终端,重新打开它,瞧,它工作了!

I am very new to this so there may be redundancies here for sure, but I know this solution cleaned everything up and worked.

我对此非常陌生,所以肯定会有裁员,但我知道这个解决方案清理了一切并且工作正常。