0

当我尝试运行时rails s,我遇到了这个巨大的错误,我刚刚重新安装了 ruby​​ 和 PostgreSQL。感谢帮助。这也是在我跑步之后rails s,我已经就类似问题发表了另一篇文章,如果这对Rails Forem 安装帮助有任何帮助的话,我仍然是 Ruby 的新手,只是为了记住这一点。再次感谢。

错误:

=> 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
/usr/local/rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:1208:in `initialize': could not connect to server: No such file or directory (PG::Error)
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:1208:in `new'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:1208:in `connect'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:326:in `initialize'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `new'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `postgresql_connection'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels) in checkout'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout'
        from /usr/local/rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection'
        from /usr/local/rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.11/lib/active_record/model_schema.rb:308:in `clear_cache!'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.11/lib/active_record/railtie.rb:97:in `block (2 levels) in <class:Railtie>'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:418:in `_run__1442159158261981509__prepare__1376751637034186401__callbacks'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:405:in `__run_callback'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:81:in `run_callbacks'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/actionpack-3.2.11/lib/action_dispa

tch/middleware/reloader.rb:74:in `prepare!'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/actionpack-3.2.11/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/railties-3.2.11/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `instance_exec'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `run'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/railties-3.2.11/lib/rails/initializable.rb:55:in `block in run_initializers'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `each'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `run_initializers'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/railties-3.2.11/lib/rails/application.rb:136:in `initialize!'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
        from /home/forem/config/environment.rb:5:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
        from /home/forem/config.ru:3:in `block in <main>'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/rack-1.4.4/lib/rack/builder.rb:51:in `instance_eval'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/rack-1.4.4/lib/rack/builder.rb:51:in `initialize'
        from /home/forem/config.ru:in `new'
        from /home/forem/config.ru:in `<main>'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/rack-1.4.4/lib/rack/builder.rb:40:in `eval'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/rack-1.4.4/lib/rack/builder.rb:40:in `parse_file'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/rack-1.4.4/lib/rack/server.rb:200:in `app'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/railties-3.2.11/lib/rails/commands/server.rb:46:in `app'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/rack-1.4.4/lib/rack/server.rb:304:in `wrapped_app'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/rack-1.4.4/lib/rack/server.rb:254:in `start'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/railties-3.2.11/lib/rails/commands/server.rb:70:in `start'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/railties-3.2.11/lib/rails/commands.rb:55:in `block in <top (required)>'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/railties-3.2.11/lib/rails/commands.rb:50:in `tap'
        from /usr/local/rvm/gems/ruby-1.9.3-p385/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>'
4

2 回答 2

1

您的 postgres 服务是否正在运行?服务 postgresql 启动

于 2013-02-25T08:39:12.373 回答
1

这是因为您的 postgresql 连接失败。确保您的 config/database.rb 设置正确。

如果您认为是,那么接下来查看您的端口设置。“/tmp/.s.PGSQL.5432”?

于 2013-02-15T01:33:03.653 回答