Невозможно установить pg gem в Windows - PullRequest
0 голосов
/ 03 ноября 2019

Я пытаюсь установить pg gem в своем проекте, но я получаю следующую ошибку при запуске gem install pg или при запуске bundle install:

ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

current directory: /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/pg-1.1.4/ext
/home/ec2-user/.rvm/rubies/ruby-2.6.3/bin/ruby -I /home/ec2- 
user/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0 -r 
./siteconf20191103-5491-ro2ye0.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/ec2-user/.rvm/rubies/ruby-2.6.3/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/ec2-user/.rvm/gems/ruby-2.6.3/extensions/x86_64-linux/2.6.0/pg- 
1.1.4/mkmf.log

extconf failed, exit code 1

Как видите, яЯ использую Ruby версии 2.6.3, и я на Windows. Я пытаюсь установить pg gem, чтобы я мог подключиться к базе данных. Я очень новичок во всем этом, поэтому любая помощь будет принята с благодарностью

1 Ответ

1 голос
/ 03 ноября 2019

Вам не хватает pg_config, что означает, что, скорее всего, пакет разработки pg не установлен.

apt install libpq-dev
...