使用ruby 1.9.2,rails3.1.0,当我尝试生成脚手架时,为什么会出现错误。
问题描述:
基本上,当我尝试生成一个脚手架,我得到这个错误 no such file to load -- openssl (LoadError)
。 错误来自使用ruby 1.9.2,rails3.1.0,当我尝试生成脚手架时,为什么会出现错误。
.rvm/gems/[email protected]/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
不知道为什么会发生这种情况。以下是完整的错误:
/home/spencer/.rvm/gems/[email protected]/gems/rack-1.3.4/lib/rack/backports/uri/common_192.rb:53: warning: already initialized constant WFKV_
/home/spencer/.rvm/gems/[email protected]/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require': no such file to load -- openssl (LoadError)
from /home/spencer/.rvm/gems/[email protected]/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
from /home/spencer/.rvm/gems/[email protected]/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from /home/spencer/.rvm/gems/[email protected]/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /home/spencer/.rvm/gems/[email protected]/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
from /home/spencer/.rvm/gems/[email protected]/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
from /home/spencer/.rvm/gems/[email protected]/gems/rack-1.3.4/lib/rack/session/cookie.rb:1:in `<top (required)>'
from /home/spencer/.rvm/gems/[email protected]/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
from /home/spencer/.rvm/gems/[email protected]/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
from /home/spencer/.rvm/gems/[email protected]/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from /home/spencer/.rvm/gems/[email protected]/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /home/spencer/.rvm/gems/[email protected]/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
from /home/spencer/.rvm/gems/[email protected]/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
from /home/spencer/.rvm/gems/[email protected]/gems/actionpack-3.1.0/lib/action_dispatch/middleware/session/cookie_store.rb:4:in `<top (required)>'
from /home/spencer/.rvm/gems/[email protected]/gems/railties-3.1.0/lib/rails/application/configuration.rb:125:in `const_get'
from /home/spencer/.rvm/gems/[email protected]/gems/railties-3.1.0/lib/rails/application/configuration.rb:125:in `session_store'
from /home/spencer/.rvm/gems/[email protected]/gems/railties-3.1.0/lib/rails/application.rb:168:in `block in default_middleware_stack'
from /home/spencer/.rvm/gems/[email protected]/gems/railties-3.1.0/lib/rails/application.rb:142:in `tap'
from /home/spencer/.rvm/gems/[email protected]/gems/railties-3.1.0/lib/rails/application.rb:142:in `default_middleware_stack'
from /home/spencer/.rvm/gems/[email protected]/gems/railties-3.1.0/lib/rails/engine.rb:445:in `app'
from /home/spencer/.rvm/gems/[email protected]/gems/railties-3.1.0/lib/rails/application/finisher.rb:37:in `block in <module:Finisher>'
from /home/spencer/.rvm/gems/[email protected]/gems/railties-3.1.0/lib/rails/initializable.rb:25:in `instance_exec'
from /home/spencer/.rvm/gems/[email protected]/gems/railties-3.1.0/lib/rails/initializable.rb:25:in `run'
from /home/spencer/.rvm/gems/[email protected]/gems/railties-3.1.0/lib/rails/initializable.rb:50:in `block in run_initializers'
from /home/spencer/.rvm/gems/[email protected]/gems/railties-3.1.0/lib/rails/initializable.rb:49:in `each'
from /home/spencer/.rvm/gems/[email protected]/gems/railties-3.1.0/lib/rails/initializable.rb:49:in `run_initializers'
from /home/spencer/.rvm/gems/[email protected]/gems/railties-3.1.0/lib/rails/application.rb:92:in `initialize!'
from /home/spencer/.rvm/gems/[email protected]/gems/railties-3.1.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/spencer/Desktop/blog/config/environment.rb:5:in `<top (required)>'
from /home/spencer/.rvm/gems/[email protected]/gems/railties-3.1.0/lib/rails/application.rb:78:in `require'
from /home/spencer/.rvm/gems/[email protected]/gems/railties-3.1.0/lib/rails/application.rb:78:in `require_environment!'
from /home/spencer/.rvm/gems/[email protected]/gems/railties-3.1.0/lib/rails/commands.rb:22:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
答
如果你在Linux下,你可以尝试这些
apt-get install openssl
apt-get install libopenssl-ruby
答
你应该能够做这样的事情:(原谅的事实,有可能是我的路径错误而我不是在我的Linux盒)
cd to ~.rvm/src/ruby-1.9.2-p290/ext/openssl
ruby extconf.rb
make
make install
基本上,只要CD创业板的源目录为您的特定版本的红宝石和重建/安装此。
你不需要重建红宝石,这是一个常见的问题。
答
好,所以我最终做的是这样的。
- 卸载红宝石的所有版本,从RVM
- 删除所有gemsets从RVM
- $ RVM PKG安装OpenSSL的
- $ RVM PKG安装的zlib
- $ RVM安装1.9.2 - 与-的OpenSSL DIR = $ HOME/.rvm在/ usr --with-zlib的-DIR = $ rvm_path的/ usr
- 在重新安装宝石轨道
之后一切正常。
这很可能不会解决问题,除非他重新编译Ruby。这个问题是由编译Ruby时缺少libopenssl-ruby库引起的。如果偶然发生这种情况,那么请阅读'rvm notes'的输出,它会告诉您要安装的确切软件包。 –
http://beginrescueend.com/packages/openssl/我现在正在尝试此操作。在第二个发现....没有工作。 –