简体   繁体   中英

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. When I try to start rails s this happen, same thing happens for 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.

Your first line of errors says you don't have config/database.yml file.

create a database.yml file inside you applications config directory and

in database.yml file

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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