Я пытаюсь развернуть приложение Rails в Heroku, и когда я добавляю гем pg
в свой гемфайл и запускаю bundle install
, я получаю сообщение об ошибке:
An error occurred while installing pg (1.1.3), and Bundler cannot continue.
Make sure that `gem install pg -v '1.1.3'` succeeds before bundling.
Нижняя часть моего гемфайла выглядит так:
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
end
group :production do
gem 'pg'
end
Когда я запускаю gem install pg
, я получаю следующее:
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
current directory: /home/scott_imunro/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/pg-1.1.3/ext
/home/scott_imunro/.rbenv/versions/2.4.2/bin/ruby -r ./siteconf20181115-1119-1gb3plu.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:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/scott_imunro/.rbenv/versions/2.4.2/bin/$(RUBY_BASE_NAME)
--with-pg
--without-pg
--enable-windows-cross
--disable-windows-cross
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/scott_imunro/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0-static/pg-1.1.3/mkmf.log
extconf failed, exit code 1
Я использую Rails 5 с Ubuntu Bash для Windows 10. Есть идеи, как решить эту ошибку?