2016-10-03 57 views
0

你知道bundler會聲稱爲什麼要安裝pg gem,然後抱怨它不能編譯它嗎?它表明gem沒有並行安裝,但是繼續嘗試安裝pg,不會產生錯誤,安裝rmagick,然後爲pg產生錯誤。Bundler聲稱它正在安裝pg,但後來抱怨說它不能安裝它(RHEL7)

當我在Gemfile中查看rmagick之前列出的pg ...非常困惑。

 
Rubygems 2.0.14 is not threadsafe, so your gems will be installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel gem installation. 
Using rake 11.3.0 
Using i18n 0.7.0 
Using json 1.8.3 
Using minitest 5.9.1 
Using thread_safe 0.3.5 
Using builder 3.2.2 
Using erubis 2.7.0 
Using mini_portile2 2.1.0 
Using pkg-config 1.1.7 
Using rack 1.6.4 
Using mime-types-data 3.2016.0521 
Using arel 6.0.3 
Using addressable 2.4.0 
Using bundler 1.13.2 
Using coderay 1.1.1 
Using concurrent-ruby 1.0.2 
Using htmlentities 4.3.1 
Using thor 0.19.1 
Using mimemagic 0.3.2 
Using net-ldap 0.12.1 
Installing pg 0.18.4 with native extensions 
Using ruby-openid 2.3.0 
Using rbpdf-font 1.19.0 
Using redcarpet 3.3.4 
Using request_store 1.0.5 
Installing rmagick 2.16.0 with native extensions 
Using tzinfo 1.2.2 
Installing nokogiri 1.6.8 with native extensions 
Using rack-test 0.6.3 
Using mime-types 3.1 
Using css_parser 1.3.7 
Using sprockets 3.7.0 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 

    /usr/bin/ruby extconf.rb 
checking for pg_config... yes 
Using config values from /usr/bin/pg_config 
*** 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 
    --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}/ 
/usr/share/ruby/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError) 
You have to install development tools first. 
    from /usr/share/ruby/mkmf.rb:519:in `try_link0' 
    from /usr/share/ruby/mkmf.rb:534:in `try_link' 
    from extconf.rb:36:in `' 


Gem files will remain installed in /tmp/.gem/ruby/gems/pg-0.18.4 for inspection. 
Results logged to /tmp/.gem/ruby/gems/pg-0.18.4/ext/gem_make.out 

An error occurred while installing pg (0.18.4), and Bundler cannot continue. 
Make sure that `gem install pg -v '0.18.4'` succeeds before bundling. 
+1

說它正在安裝它 - 它告訴你,這就是今天要嘗試安裝的東西...並不是它已經成功安裝它。爲了解決這個問題,谷歌這個錯誤:'extconf.rb失敗'和「pg gem」(問題是這部分:「你必須先安裝開發工具。」) –

+0

所以你的意思是所有的行在「使用本機擴展安裝pg 0.18.4」之後與創建pg gem有關?爲什麼必須安裝rmagick來安裝pg gem?它具體表明它不是並行安裝東西。 – Angelo

+0

它沒有...正如我所說的,'Installing '這個詞並不意味着「我剛剛安裝了叫做'gemname'的寶石」 - 他們只是說「在這個捆綁過程中,我會安裝寶石叫做'gemname'「... ... bundler通過你的Gemfile查找需要安裝的所有gem,不管它們是自己列出還是依賴於另一個......並列出所有需要安裝的安裝...''pg'和'rmagick'之間可能沒有任何連接,除非還沒有安裝。 –

回答

0

您可能沒有安裝PostgreSQL。它也發生在我的macOS上。我只是做了brew install postgresql並再次運行bundle。如果你在任何其他操作系統上,你需要相應地安裝PostgreSQL。
這將做的是安裝寶石所需的所有缺少的庫。

0

很可能你沒有在你的機器上安裝postgresql軟件。 這就是爲什麼當你試圖安裝gem時,它找不到postgresql軟件的executable.Hence打包程序無法安裝gem。 在機器上安裝PostgreSQL

sudo apt-get install postgresql postgresql-contrib #If you are on linux(ubuntu). 

brew install postgresql #If you are on mac 

希望你有你的答案。享受

相關問題