Rails服务器在启动后立即退出

时间:2013-07-17 13:36:58

标签: ruby-on-rails ruby

我是rails的新手,我从github下载了一个我正在尝试处理的回购。 当我尝试启动rails时会发生这种情况,对于rails c:

也会发生同样的事情
=> Booting WEBrick
=> Rails 3.2.12 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/application/configuration.rb:115:in `read': No such file or directory - /Users/falk/Desktop/parkbuddy/config/database.yml (Errno::ENOENT)
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/application/configuration.rb:115:in `database_configuration'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.12/lib/active_record/railtie.rb:78:in `block (2 levels) in <class:Railtie>'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.12/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.12/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.12/lib/active_support/lazy_load_hooks.rb:26:in `block in on_load'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.12/lib/active_support/lazy_load_hooks.rb:25:in `each'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.12/lib/active_support/lazy_load_hooks.rb:25:in `on_load'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.12/lib/active_record/railtie.rb:74:in `block in <class:Railtie>'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `instance_exec'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `run'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `each'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `run_initializers'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/application.rb:136:in `initialize!'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /Users/falk/Desktop/parkbuddy/config/environment.rb:5:in `<top (required)>'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'
    from /Users/falk/Desktop/parkbuddy/config.ru:3:in `block in <main>'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
    from /Users/falk/Desktop/parkbuddy/config.ru:in `new'
    from /Users/falk/Desktop/parkbuddy/config.ru:in `<main>'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/commands/server.rb:46:in `app'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/commands/server.rb:70:in `start'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/commands.rb:55:in `block in <top (required)>'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/commands.rb:50:in `tap'
    from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

我试过谷歌搜索解决方案,但我找不到任何东西。

3 个答案:

答案 0 :(得分:3)

您的第一行错误表明您没有config/database.yml档案。

在应用程序database.yml目录和

中创建一个config文件 <{1>}文件中的

database.yml

答案 1 :(得分:2)

第一行显示您的问题:

/Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/application/configuration.rb:115:in `read': No such file or directory - /Users/falk/Desktop/parkbuddy/config/database.yml (Errno::ENOENT)

您的Rails应用中不存在config/database.yml文件。请查看应用程序的文档,了解它对数据库配置的建议。

答案 2 :(得分:0)

我有同样的问题,但答案不同......

fabio@ubuntu:~/Desktop/teste/foo$ rails server
=> Booting WEBrick
=> Rails 4.0.0 application starting in development on localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
/var/lib/gems/1.9.1/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:191:in `normalize_conditions!': You should not use the `match` method in your router without specifying an HTTP method. (RuntimeError)
If you want to expose your action to both GET and POST, add `via: [:get, :post]` option.
If you want to expose your action to GET, use `get` in the router:
  Instead of: match "controller#action"
  Do: get "controller#action"
    from /var/lib/gems/1.9.1/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:67:in `initialize'
    from /var/lib/gems/1.9.1/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1438:in `new'
...