gpt4 book ai didi

ruby-on-rails - rake 数据库 :Create will not connect to PostGresql and set up database

转载 作者:行者123 更新时间:2023-11-29 13:02:38 24 4
gpt4 key购买 nike

我有一个 Rails 项目,我已将其 git 存储库 fork 并下载到我的计算机上。它正在为我团队中的其他人运行,但是,当我运行时

rake db:create

我收到以下错误,它无法连接到 postgres,即使它正在我的计算机上运行。

could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:888:in `initialize'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:888:in `new'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:888:in `connect'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:568:in `initialize'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `new'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `postgresql_connection'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:435:in `new_connection'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:445:in `checkout_new_connection'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:416:in `acquire_connection'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:351:in `block in checkout'
/usr/local/rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:350:in `checkout'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `block in connection'
/usr/local/rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:264:in `connection'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:541:in `retrieve_connection'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.4/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.4/lib/active_record/connection_handling.rb:87:in `connection'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.4/lib/active_record/tasks/postgresql_database_tasks.rb:8:in `connection'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.4/lib/active_record/tasks/postgresql_database_tasks.rb:17:in `create'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.4/lib/active_record/tasks/database_tasks.rb:88:in `create'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.4/lib/active_record/tasks/database_tasks.rb:102:in `block in create_current'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.4/lib/active_record/tasks/database_tasks.rb:209:in `block in each_current_configuration'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.4/lib/active_record/tasks/database_tasks.rb:208:in `each'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.4/lib/active_record/tasks/database_tasks.rb:208:in `each_current_configuration'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.4/lib/active_record/tasks/database_tasks.rb:101:in `create_current'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activerecord-4.1.4/lib/active_record/railties/databases.rake:17:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/rake-10.3.2/lib/rake/task.rb:240:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/rake-10.3.2/lib/rake/task.rb:240:in `block in execute'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/rake-10.3.2/lib/rake/task.rb:235:in `each'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/rake-10.3.2/lib/rake/task.rb:235:in `execute'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/rake-10.3.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/rake-10.3.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/rake-10.3.2/lib/rake/task.rb:165:in `invoke'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/rake-10.3.2/lib/rake/application.rb:150:in `invoke_task'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/rake-10.3.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/rake-10.3.2/lib/rake/application.rb:106:in `each'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/rake-10.3.2/lib/rake/application.rb:106:in `block in top_level'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/rake-10.3.2/lib/rake/application.rb:115:in `run_with_threads'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/rake-10.3.2/lib/rake/application.rb:100:in `top_level'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/rake-10.3.2/lib/rake/application.rb:78:in `block in run'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/rake-10.3.2/bin/rake:33:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.0.0-p481/bin/rake:23:in `load'
/usr/local/rvm/gems/ruby-2.0.0-p481/bin/rake:23:in `<main>'
/usr/local/rvm/gems/ruby-2.0.0-p481/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.0.0-p481/bin/ruby_executable_hooks:15:in `<main>'
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "database"=>"source_development"}

有人对可能发生的事情有任何想法吗?

最佳答案

您的 Pg gem 是针对 Apple 的 libpq 而不是您安装的 PostgreSQL 的 libpq 编译的。所以它有错误的默认 unix_socket_directories

尝试:

host: /tmp

host: localhost

关于ruby-on-rails - rake 数据库 :Create will not connect to PostGresql and set up database,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24854433/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com