ruby 安装pg(1.2.3)时出错,Bundler无法继续

o2rvlv0m  于 2023-01-30  发布在  Ruby
关注(0)|答案(4)|浏览(260)

我已经看到过无数次了,但是我通常的修复和堆栈溢出建议这次不起作用了。
当我运行bundle install时,它在pg:

An error occurred while installing pg (1.2.3), and Bundler cannot
continue.

过去,我解决这个问题的方法是先运行gem install bundler,然后再运行bundle install。这次,运气不好。有什么建议吗?

8tntrjer

8tntrjer1#

当然,当我发布这篇文章的时候,我发现了另一个stackoverflow问题的解决方案。
这一招奏效了:

gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config
mwkjh3gx

mwkjh3gx2#

值得一提的是,您需要在任何尝试安装gem的机器上安装Postgres,以便安装gem。
这对一些人来说可能是显而易见的,但对另一些人来说却不是。
要验证实际问题是否是计算机上缺少Postgres,错误应该与以下内容类似:

Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.
polkgigr

polkgigr3#

我也面临同样的问题,我已经通过安装brew install postgresql并再次运行bundle install解决了这个问题

332nm8kg

332nm8kg4#

sudo apt install postgresql-contrib libpq-dev

相关问题