我是Linux的新手,我刚安装了一个基于fedora的发行版korora。 我安装了rails但是当我尝试创建新项目并在终端中编写bundle install时出现了这个错误
Fetching gem metadata from https://rubygems.org/..............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 12.0.0
Using concurrent-ruby 1.0.2
Using i18n 0.7.0
Using minitest 5.10.1
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.1.0
Using rack 2.0.1
Using nio4r 1.2.1
Using websocket-extensions 0.1.2
Using mime-types-data 3.2016.0521
Using arel 7.1.4
Using bundler 1.13.6
Using byebug 9.0.6
Using ffi 1.9.14
Using rb-fsevent 0.9.8
Using method_source 0.8.2
Installing pg 0.19.0 with native extensions
Using puma 3.6.2
Using thor 0.19.4
Using tzinfo 1.2.2
Using nokogiri 1.6.8.1
Using rack-test 0.6.3
Using sprockets 3.7.0
Using websocket-driver 0.6.4
Using mime-types 3.1
Using rb-inotify 0.9.7
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/myusername/.gem/ruby/gems/pg-0.19.0/ext
/usr/bin/ruby -r ./siteconf20161213-11986-1jtdscv.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}/lib64
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/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}/lib64
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/myusername/.gem/ruby/extensions/x86_64-linux/2.3.0/pg-0.19.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/myusername/.gem/ruby/gems/pg-0.19.0 for inspection.
Results logged to /home/myusername/.gem/ruby/extensions/x86_64-linux/2.3.0/pg-0.19.0/gem_make.out
An error occurred while installing pg (0.19.0), and Bundler cannot continue.
Make sure that `gem install pg -v '0.19.0'` succeeds before bundling.
我不知道该怎么做,我想尽可能地解决这个问题。
答案 0 :(得分:2)
您需要先安装开发pg库。
yum install postgresql-devel
或者如果你正在使用apt:
apt-get install libpq-dev
然后gem install pg -v '0.19.0'
。
答案 1 :(得分:0)
尝试:
sudo dnf install libpq-devel
然后:
gem install pg
或:
bundle install
它与Fedora 30上的Rails 5.2一起适用于我