Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 首先是Heroku,Ruby&;Postgres应用程序-本地Postgres错误_Ruby On Rails_Ruby_Postgresql_Heroku - Fatal编程技术网

Ruby on rails 首先是Heroku,Ruby&;Postgres应用程序-本地Postgres错误

Ruby on rails 首先是Heroku,Ruby&;Postgres应用程序-本地Postgres错误,ruby-on-rails,ruby,postgresql,heroku,Ruby On Rails,Ruby,Postgresql,Heroku,我一直在遵循Heroku的Ruby-on-Heroku入门指南,在尝试连接postgres数据库时遇到了困难 当我跑步时: bundle exec rake db:create db:migrate 我留下了这个错误: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socke

我一直在遵循Heroku的Ruby-on-Heroku入门指南,在尝试连接postgres数据库时遇到了困难

当我跑步时:

bundle exec rake db:create db:migrate
我留下了这个错误:

could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
以及:

我已尝试编辑我的database.yml文件,但我不确定是否更改了正确的参数:

default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: 5

development:
<<: *default
database: ruby-getting-started_development
username: ruby-getting-started

test:
<<: *default
database: ruby-getting-started_test

production:
<<: *default
database: ruby-getting-started_production
username: ruby-getting-started
password: <%= ENV['RUBY-GETTING-STARTED_DATABASE_PASSWORD'] %>
default:&default
适配器:postgresql
编码:unicode
#有关连接池的详细信息,请参阅rails配置指南
# http://guides.rubyonrails.org/configuring.html#database-汇集
游泳池:5
发展:

这是一个常见的Postgres错误,基本上是告诉您它找不到服务器。这可能是由于各种原因造成的,比如没有将其安装到操作系统更新的断开路径

如果您确实安装了服务器,您可以通过自制或postgres.org上的GUI windows安装程序重新安装


无论哪种方法,最快的修复方法都是使用单个软件包安装程序,如mac版的Postgres.app。

尝试使用命令pg_ctl-D/usr/local/var/Postgres-l/usr/local/var/Postgres/server.log启动,然后执行db:migrateHey-man,我尝试运行该命令,结果是:garrett@garrett-虚拟机:~/ruby入门$pg_ctl-D/usr/local/var/postgres-l/usr/local/var/postgres/server.log启动pg_ctl:未指定协调器或数据节点选项(-Z)请尝试“pg_ctl--help”获取更多信息。消息的Coordinator或Datanode选项部分显示您没有postgresql,但是。可能您在安装过程中选择了错误的软件包。Ubuntu在找不到psql时出现了一条不幸的错误消息,这可能会导致错误。谢谢你的回复,Daniel。我删除了Postgres xc并运行了:sudo apt get install postgresql-9.3 Now,我在运行bundle exec rake db:create db:migrate无法连接到服务器:没有这样的文件或目录是在本地运行并接受unix域套接字连接的服务器“/var/run/postgresql/.s.PSQL.5432
default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: 5

development:
<<: *default
database: ruby-getting-started_development
username: ruby-getting-started

test:
<<: *default
database: ruby-getting-started_test

production:
<<: *default
database: ruby-getting-started_production
username: ruby-getting-started
password: <%= ENV['RUBY-GETTING-STARTED_DATABASE_PASSWORD'] %>