2017-02-02 2 views
8

Я застреваю, пытаясь разобраться с RoR. Я сделал Ruby Installfest, но я столкнулся с проблемой с тем, что, на мой взгляд, является openssl.bundle.Свежая установка Rails и получение ошибок OpenSSL: «уже инициализированная константа OpenSSL»

Я использую RVM, и я бег Rails 5.0.1 и 2.4.0 рубина

Я попробовал полное удаление/новый старт с помощью rvm implode и прошел через все и заново следующий RailsApps Guide, но я до сих пор вижу идентичное ошибка. Я использую последнюю версию macOS Sierra.

Это результат, который я получаю при запуске $ Rake -T в my_app.

[email protected]:~/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/gems/activesupport-5.0.1/lib/active_support/key_generator.rb:2:in `require' 
/Users/richsmith/.rvm/gems/[email protected]/gems/activesupport-5.0.1/lib/active_support/key_generator.rb:2:in `<top (required)>' 
/Users/richsmith/.rvm/gems/[email protected]/gems/railties-5.0.1/lib/rails/application.rb:4:in `require' 
/Users/richsmith/.rvm/gems/[email protected]/gems/railties-5.0.1/lib/rails/application.rb:4:in `<top (required)>' 
/Users/richsmith/.rvm/gems/[email protected]/gems/railties-5.0.1/lib/rails.rb:11:in `require' 
/Users/richsmith/.rvm/gems/[email protected]/gems/railties-5.0.1/lib/rails.rb:11:in `<top (required)>' 
/Users/richsmith/.rvm/gems/[email protected]/gems/railties-5.0.1/lib/rails/all.rb:1:in `require' 
/Users/richsmith/.rvm/gems/[email protected]/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/[email protected]/gems/rake-12.0.0/exe/rake:27:in `<top (required)>' 
(See full trace by running task with --trace) 

ответ

18

камень деинсталлировать OpenSSL 2.0.3 -v

камень установить OpenSSL 2.0.2 -v

Это должно исправить.

+0

Вы были абсолютно правы. Проблема, похоже, вытекает из версии 2.0.3, но когда я вернулся к версии, она работает нормально. Любые идеи почему? – Rich

+0

На самом деле вам не нужно снова устанавливать openssl. openssl - это один из встроенных камней по умолчанию. –

+0

Работал для меня тоже! Благодаря! – jayp

5

Решено это через 3 часа. Проблема была очевидна в файлах журналов, что-то случилось с openSSL.

Решение было:

  1. Удалить все следы вопроса rvm implode

  2. Оттуда я новую установку РВМ использованием $ \curl -L https://get.rvm.io | bash -s stable

  3. закрытое и вновь терминал.

  4. установлен рубин $ rvm install ruby-2.4.0
  5. Обновлен менеджер гем $ gem update --system
  6. Изменен глобального gemset с помощью $ rvm gemset use global
  7. Затем обновляются все драгоценные камни, используя $ gem update
  8. Отсюда я установил Bundler и Nokogiri (не уверен, если это зависимая для openSSL, но не имела шансов) с использованием $ gem install bundler и gem install nokogiri
  9. Отсюда я создал новый гемсет для установки рельсов с использованием $ rvm use [email protected] --create
  10. Затем я установил последнюю версию рельсов с помощью $ gem install rails
  11. Не желая рисковать в этот момент, я удалил OpenSSL с помощью gem uninstall openssl
  12. Затем переустановил его gem install openssl
  13. Наконец, я закрыл свой терминал, возобновлено это и вуаля, это сработало!

Я очень новичок в этом, поэтому здесь могут быть избытки, но я знаю, что это решение очистило все и работало.

8

Я решил эту проблему, добавив строку:

Gem 'OpenSSL', '> = 2.0.3'

моей Gemfile.По-видимому, bundler загружает как стандартную версию 2.0.2, так и новую версию 2.0.3. Вышеуказанная линия предотвращает это.

+2

Я предпочитаю ваше решение. Понижение openSSL кажется более опасным, чем что-либо еще. –