简体   繁体   English

创建新的 Rails 项目时出现 OpenSSL 错误

[英]OpenSSL error when creating a new Rails project

I'm trying to create a new Rails project using the railstutorial.org.我正在尝试使用 railstutorial.org 创建一个新的 Rails 项目。 However, when I try to create a new app, I get the following error:但是,当我尝试创建新应用程序时,出现以下错误:

User-MacBook-Air:rails_projects user$ rails new first_ap
/user.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': dlopen(/user.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/x86_64-darwin12.5.0/digest/md5.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib (LoadError)
  Referenced from: /user.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/x86_64-darwin12.5.0/digest/md5.bundle
  Reason: image not found - /user.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/x86_64-darwin12.5.0/digest/md5.bundle
    from /user.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /user.rvm/gems/ruby-1.9.3-p448@rails3tutorial2ndEd/gems/railties-3.2.14/lib/rails/generators/app_base.rb:1:in `<top (required)>'
    from /user.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /user.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /user.rvm/gems/ruby-1.9.3-p448@rails3tutorial2ndEd/gems/railties-3.2.14/lib/rails/generators/rails/app/app_generator.rb:1:in `<top (required)>'
    from /user.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /user.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /user.rvm/gems/ruby-1.9.3-p448@rails3tutorial2ndEd/gems/railties-3.2.14/lib/rails/commands/application.rb:24:in `<top (required)>'
    from /user.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /user.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /user.rvm/gems/ruby-1.9.3-p448@rails3tutorial2ndEd/gems/railties-3.2.14/lib/rails/cli.rb:15:in `<top (required)>'
    from /user.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /user.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /user.rvm/gems/ruby-1.9.3-p448@rails3tutorial2ndEd/gems/railties-3.2.14/bin/rails:7:in `<top (required)>'
    from /user.rvm/gems/ruby-1.9.3-p448@rails3tutorial2ndEd/bin/rails:23:in `load'
    from /user.rvm/gems/ruby-1.9.3-p448@rails3tutorial2ndEd/bin/rails:23:in `<main>'

How do I get rid of this OpenSSL error?如何摆脱这个 OpenSSL 错误? I am using the following:我正在使用以下内容:

Rails 3.2.14
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-darwin12.5.0]

rvm 1.22.11 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

Well, there's a very large chance it was overkill but for me uninstalling ruby entirely and then reinstalling it and all the gems that my project uses solved the problem.好吧,它很有可能是矫枉过正,但对我来说,完全卸载 ruby​​ 然后重新安装它,我的项目使用的所有 gem 都解决了这个问题。

If you're using rbenv, the commands that I used were如果您使用的是 rbenv,我使用的命令是
rbenv uninstall 2.6.3
rbenv install 2.6.3
gem install bundler
gem install rails -v 6.0.2
rbenv rehash
bundle update

Again, this is probably overkill, but it solved the problem after brew install openssl didn't work for me.同样,这可能有点矫枉过正,但它在brew install openssl对我不起作用后解决了问题。

If you haven't installed OpenSSL, try installing it with Homebrew如果您还没有安装 OpenSSL,请尝试使用Homebrew安装它

brew install openssl

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM