【问题标题】:rails s does not start my projectrails s 没有启动我的项目
【发布时间】:2013-02-01 22:52:16
【问题描述】:

我尝试了很多来自网络的不同解决方案,但我无法解决这个问题。 这是我在执行 rails s 时遇到的错误

bash-3.2$ rails s
=> Booting WEBrick
=> Rails 3.2.11 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- openssl (LoadError)
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/rack-1.4.4/lib/rack/session/cookie.rb:1:in `<top (required)>'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/actionpack-3.2.11/lib/action_dispatch/middleware/session/cookie_store.rb:4:in `<top (required)>'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/railties-3.2.11/lib/rails/application/configuration.rb:140:in `const_get'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/railties-3.2.11/lib/rails/application/configuration.rb:140:in `session_store'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/railties-3.2.11/lib/rails/application.rb:273:in `block in default_middleware_stack'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/railties-3.2.11/lib/rails/application.rb:237:in `tap'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/railties-3.2.11/lib/rails/application.rb:237:in `default_middleware_stack'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/railties-3.2.11/lib/rails/engine.rb:469:in `app'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/railties-3.2.11/lib/rails/application/finisher.rb:31:in `block in <module:Finisher>'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `instance_exec'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `run'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/railties-3.2.11/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `each'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `run_initializers'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/railties-3.2.11/lib/rails/application.rb:136:in `initialize!'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /Users/sr027976/test_app/phappinfra_starter_app/config/environment.rb:5:in `<top (required)>'
    from /Users/sr027976/test_app/phappinfra_starter_app/config.ru:3:in `require'
    from /Users/sr027976/test_app/phappinfra_starter_app/config.ru:3:in `block in <main>'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/rack-1.4.4/lib/rack/builder.rb:51:in `instance_eval'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/rack-1.4.4/lib/rack/builder.rb:51:in `initialize'
    from /Users/sr027976/test_app/phappinfra_starter_app/config.ru:in `new'
    from /Users/sr027976/test_app/phappinfra_starter_app/config.ru:in `<main>'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/rack-1.4.4/lib/rack/builder.rb:40:in `eval'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/rack-1.4.4/lib/rack/builder.rb:40:in `parse_file'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/rack-1.4.4/lib/rack/server.rb:200:in `app'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/railties-3.2.11/lib/rails/commands/server.rb:46:in `app'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/rack-1.4.4/lib/rack/server.rb:304:in `wrapped_app'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/rack-1.4.4/lib/rack/server.rb:254:in `start'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/railties-3.2.11/lib/rails/commands/server.rb:70:in `start'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/railties-3.2.11/lib/rails/commands.rb:55:in `block in <top (required)>'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/railties-3.2.11/lib/rails/commands.rb:50:in `tap'
    from /Users/sr027976/.rvm/gems/ruby-1.9.3-p374@phappinfra_starter_app/gems/railties-3.2.11/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

【问题讨论】:

  • 您确定您的计算机上实际安装了 openssl 吗?
  • 是的。 bash-3.2$ openssl 版本 OpenSSL 0.9.8r 2011 年 2 月 8 日
  • ssl 可能已安装,但 ruby​​ 找不到它。你是如何安装红宝石的? RVM?您是否指定了--with-open-ssl-dir?你试过rvm pkg install ssl吗?

标签: ruby-on-rails ruby ruby-on-rails-3 rubygems ruby-on-rails-3.2


【解决方案1】:

假设您已正确安装了 opensll - 您应该通过重新安装来检查,这听起来像是与 RVM 相关的问题。最糟糕的情况是我会尝试重新安装 RVM(这有点麻烦)

【讨论】:

    【解决方案2】:

    使用 RVM 创建 gemset

    rvm gemset create gemset_name
    

    然后运行

    bundle install
    

    这实际上是gem依赖的问题。

    【讨论】:

      【解决方案3】:

      这些是我执行的步骤,它对我有用。 rvm 得到头部

      rvm requirements
      rvm pkg remove
      brew install libksba autoconf automake
      rvm reinstall 1.9.2 --with-openssl-dir=/usr/local
      rvm pkg install readline --verify-downloads 1
      rvm use 1.9.3 --default
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-04-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多