Gemfileに、pgのgemを追加(PostgreSQLです)して、bundle installを流しても、gemがありませんというエラーが出てきます。gem listで確認すると、確かに、pgはインストールされていないようです。
gem installを使って、個別にインストールすれば解決するとは思うのですが、bundle installで自動でインストールされない理由は何が考えられるのでしょうか。
gem "pg"
環境はどのようなものでしょうか?
Ubuntu20.4をVirtual Box + Vagrantで動かしています。
Railsは5.2.6
Rubyは2.6.0です。
PostgreSQLのバージョンは12です。
> bundle installを流しても、gemがありませんというエラーが出てきます。
エラーメッセージは「それだけ」ですか?要約せずに全文出していただけないでしょうか。
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.
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/vagrant/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/pg-1.2.3/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/vagrant/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/pg-1.2.3 for inspection.
Results logged to
/home/vagrant/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/pg-1.2.3/gem_make.out
An error occurred while installing pg (1.2.3), and Bundler cannot continue.
Make sure that `gem install pg -v '1.2.3' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
pg
長くで恐縮ですが、エラー内容です。

回答1件
あなたの回答
tips
プレビュー