Ruby on rails 捆绑包安装时出现Postgresql错误

Ruby on rails 捆绑包安装时出现Postgresql错误,ruby-on-rails,postgresql,heroku,postgresql-9.1,Ruby On Rails,Postgresql,Heroku,Postgresql 9.1,我认为这是一个常见的问题,但是我在互联网上找到的解决方案并不适合我。当我运行bundle安装时,将此部分放在我的文件中 group :production, :staging do gem "pg" end group :development, :test do gem "sqlite3-ruby", :require => "sqlite3" end 我得到以下错误 creating Makefile make compiling gvl_wrappers.c compi

我认为这是一个常见的问题,但是我在互联网上找到的解决方案并不适合我。当我运行bundle安装时,将此部分放在我的文件中

group :production, :staging do
  gem "pg"
end

group :development, :test do
  gem "sqlite3-ruby", :require => "sqlite3"
end
我得到以下错误

creating Makefile

make
compiling gvl_wrappers.c
compiling pg.c
pg.c: In function ‘Init_pg_ext’:
pg.c:375: error: ‘PQPING_OK’ undeclared (first use in this function)
pg.c:375: error: (Each undeclared identifier is reported only once
pg.c:375: error: for each function it appears in.)
pg.c:377: error: ‘PQPING_REJECT’ undeclared (first use in this function)
pg.c:379: error: ‘PQPING_NO_RESPONSE’ undeclared (first use in this function)
pg.c:381: error: ‘PQPING_NO_ATTEMPT’ undeclared (first use in this function)
make: *** [pg.o] Error 1


Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p194/gems/pg-0.16.0 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p194/gems/pg-0.16.0/ext/gem_make.out
根据我的发现,下一步是运行
locate pg_config
,然后将位置放在
gem install pg
命令行语句之后。但是,我得到了以下错误:

WARNING: The locate database (/var/db/locate.database) does not exist.
To create the database, run the following command:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist

Please be aware that the database can take some time to generate; once
the database has been created, this message will no longer appear.
然后我运行
sudo
命令,得到最后一个错误

launchctl: Couldn't stat("/System/Library/LaunchDaemons/com.apple.locate.plis"): No such file or directory
nothing found to load
这是我第一次尝试使用这种技术,对Mac来说也是全新的。任何帮助都将不胜感激。谢谢

编辑


我正试图遵循关于这个错误的建议

看起来不管你的gemfile怎么说,你都试图在本地安装postgres

真的,这就是你应该做的。在生产环境中使用与本地使用的数据库不同的数据库是非常不理想的。我强烈建议在任何地方都使用Postgres,并删除sqlite


在Mac电脑上,通往这一天堂的最简单途径是安装

看起来不管你的gemfile怎么说,你是在本地安装postgres

真的,这就是你应该做的。在生产环境中使用与本地使用的数据库不同的数据库是非常不理想的。我强烈建议在任何地方都使用Postgres,并删除sqlite


在Mac电脑上,最简单的方法就是安装

Ok so。。我通过链接安装了Postgress.app。然后再次运行上面的所有命令(bundle install、locate pg…,等等),并收到相同的错误消息。如果您再次运行它,我猜在安装pg gem时,它将以类似“/usr/local/rvm/gems/ruby-1.9.3-p194/gems/pg-0.16.0/ext/foobar.out”的内容结束。如果是这样,请将foorbar.out的输出也粘贴到这里。顺便说一下,您所指的要点建议尝试使用0.15.1。我在Ruby 2和pg gem上从来没有遇到过任何问题,我知道我使用的是0.15.1。您能否尝试更改gem文件,使其具有行
gem'pg',“~>0.15.1”
-保存,并进行捆绑安装,然后查看发生了什么情况?好的。。我通过链接安装了Postgress.app。然后再次运行上面的所有命令(bundle install、locate pg…,等等),并收到相同的错误消息。如果您再次运行它,我猜在安装pg gem时,它将以类似“/usr/local/rvm/gems/ruby-1.9.3-p194/gems/pg-0.16.0/ext/foobar.out”的内容结束。如果是这样,请将foorbar.out的输出也粘贴到这里。顺便说一下,您所指的要点建议尝试使用0.15.1。我在Ruby 2和pg gem上从来没有遇到过任何问题,我知道我使用的是0.15.1。您可以尝试更改gem文件,使其具有行
gem'pg',“~>0.15.1”
-保存并进行捆绑安装,然后看看会发生什么情况吗?它是一个.plist文件,而不是.plis-您可以在mac上使用mdfind而不是locate。mdfind使用mac os x spotlight文件数据库能够跟踪pg_配置文件的位置(
/usr/bin/pg_config
),但是在将其添加到
gem install
语句后仍然收到相同的错误。它是一个.plist文件,而不是.plis-您可以使用mdfind而不是在mac上定位。mdfind使用mac os x spotlight文件数据库能够跟踪pg_配置文件的位置(
/usr/bin/pg_config
),但是在将其添加到
gem install
语句后仍然收到相同的错误。