ruby-on-rails - 捆绑安装时出现 Postgresql 错误

标签 ruby-on-rails postgresql heroku postgresql-9.1

我认为这是一个常见问题,但我在 Internet 上找到的解决方案对我不起作用。当我在我的 gemfile 中使用此部分运行 bundle install 时

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 来说也是全新的。任何帮助,将不胜感激。谢谢!

编辑

我正在尝试遵循建议 located here关于这个错误。

最佳答案

不管您的 gemfile 怎么说,您似乎都在尝试在本地安装 postgres?

真的,那是你应该做的。在生产中使用与本地使用的数据库不同的数据库确实不是最佳选择。我强烈建议到处使用 Postgres,并删除 sqlite。

在 Mac 上,实现此必杀技的最简单途径是安装 Postgress.app

关于ruby-on-rails - 捆绑安装时出现 Postgresql 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18349114/

相关文章:

ruby-on-rails - 使用枚举时修改 simple_form 输入中显示的文本

python - psycopg2.ProgrammingError : syntax error at or near "\"

ruby-on-rails - 从 :through Association 查询

ruby-on-rails - 向 Spree 结账流程添加一个步骤

php - Symfony 3.4,FOSUserBundle : SQL Errors with postgresql

ruby-on-rails - 如何逐行读取 ruby​​ 中的文本文件(将其托管在 s3 上)?

heroku - 如何在 Heroku 中为 webapp-runner 指定自定义信任库?

ruby-on-rails - 如何 rake 数据库 :migrate on a Heroku staging pipeline?

ruby-on-rails - 如何从我的网站在 Facebook 上发布新闻源

sql - 下一个可用值 - postgresql