简体   繁体   English

Rails服务器启动后立即退出

[英]Rails server exiting immediately after starting

I'm new to rails and I downloaded a repo from github which I'm trying to work on. 我是Rails的新手,我从github下载了一个我正在尝试的回购。 When I try to start rails s this happen, same thing happens for rails c: 当我尝试启动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>'

I have tried googling a solution but I can't find anything. 我尝试使用Google搜索解决方案,但找不到任何东西。

Your first line of errors says you don't have config/database.yml file. 您的第一行错误是您没有config/database.yml文件。

create a database.yml file inside you applications config directory and 在应用程序config目录中创建一个database.yml文件,然后

in database.yml file database.yml文件中

development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000


test:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000


production:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

The first line is showing you your problem: 第一行向您显示您的问题:

/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)

The config/database.yml file is not present in your Rails app. config/database.yml文件在您的Rails应用程序中不存在。 Check with the app's documentation to see what it suggest you do about database configuration. 请查看该应用程序的文档,以了解它对数据库配置的建议。

I hava the same problem but with a different answer... 我遇到了同样的问题,但是答案却不同。

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'
...

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

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