在Rails服务器上启动Ruby时出错

时间:2018-01-14 21:57:26

标签: ruby-on-rails ruby

我正在尝试在本地系统上的rails应用程序上运行ruby,但在执行rails server命令时,我收到以下错误:

/Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/railties-3.2.18/lib/rails/application/configuration.rb:115:in `read': No such file or directory @ rb_sysopen - /Users/carlossosa/honda/documentolegal2/config/database.yml (Errno::ENOENT)
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/railties-3.2.18/lib/rails/application/configuration.rb:115:in `database_configuration'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/activerecord-3.2.18/lib/active_record/railtie.rb:84:in `block (2 levels) in <class:Railtie>'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/activesupport-3.2.18/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/activesupport-3.2.18/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/activesupport-3.2.18/lib/active_support/lazy_load_hooks.rb:26:in `block in on_load'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/activesupport-3.2.18/lib/active_support/lazy_load_hooks.rb:25:in `each'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/activesupport-3.2.18/lib/active_support/lazy_load_hooks.rb:25:in `on_load'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/activerecord-3.2.18/lib/active_record/railtie.rb:80:in `block in <class:Railtie>'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/railties-3.2.18/lib/rails/initializable.rb:30:in `instance_exec'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/railties-3.2.18/lib/rails/initializable.rb:30:in `run'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/railties-3.2.18/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/railties-3.2.18/lib/rails/initializable.rb:54:in `each'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/railties-3.2.18/lib/rails/initializable.rb:54:in `run_initializers'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/railties-3.2.18/lib/rails/application.rb:136:in `initialize!'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/railties-3.2.18/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /Users/carlossosa/honda/documentolegal2/config/environment.rb:5:in `<top (required)>'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:251:in `require'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:251:in `require'
    from /Users/carlossosa/honda/documentolegal2/config.ru:3:in `block in <main>'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/rack-1.4.7/lib/rack/builder.rb:51:in `instance_eval'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/rack-1.4.7/lib/rack/builder.rb:51:in `initialize'
    from /Users/carlossosa/honda/documentolegal2/config.ru:in `new'
    from /Users/carlossosa/honda/documentolegal2/config.ru:in `<main>'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/rack-1.4.7/lib/rack/builder.rb:40:in `eval'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/rack-1.4.7/lib/rack/builder.rb:40:in `parse_file'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/rack-1.4.7/lib/rack/server.rb:200:in `app'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/railties-3.2.18/lib/rails/commands/server.rb:46:in `app'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/rack-1.4.7/lib/rack/server.rb:304:in `wrapped_app'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/rack-1.4.7/lib/rack/server.rb:254:in `start'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/railties-3.2.18/lib/rails/commands/server.rb:70:in `start'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/railties-3.2.18/lib/rails/commands.rb:55:in `block in <top (required)>'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/railties-3.2.18/lib/rails/commands.rb:50:in `tap'
    from /Users/carlossosa/.rvm/gems/ruby-2.2.5/gems/railties-3.2.18/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

好像您缺少数据库配置文件

#{project_root}/config/database.yml

您需要创建一个。您可以在以下链接中找到有关如何设置的信息:

http://guides.rubyonrails.org/configuring.html#configuring-a-database

希望得到这个帮助。