[英]gem install pg -v '0.17.1' not working for some reason
我正在嘗試通過 AWS EC2 Linux 服務器中的 rails 應用程序“捆綁”。 我收到“pg”gem 的這個錯誤。 有人可以幫忙嗎? 找不到解決辦法。
這個 gem 'pg' 的版本是 0.17.1。
Ruby 版本為 ruby 2.3.1p112 (2016-04-26 修訂版 54768) [x86_64-linux]
$ gem install pg
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
current directory: /home/ec2-user/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/pg-0.21.0/ext
/home/ec2-user/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20180105-17661-1wdsn6j.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--something something something
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/ec2-user/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/pg-0.21.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/ec2-user/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/pg-0.21.0 for inspection.
Results logged to /home/ec2-user/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/pg-0.21.0/gem_make.out
當我在centos
或ubuntu
上安裝gem 'pg'
時,我遇到了一些和你一樣的問題。
對於centos,你可以這樣做:
yum install postgresql-libs
yum install postgresql-devel
然后再次運行gem install pg
。
在 Ubuntu 上,我需要運行:
sudo apt-get install libpq-dev
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.