Nokogiri导致捆绑安装问题

时间:2016-06-16 11:03:43

标签: ruby-on-rails ruby nokogiri

之前曾与Ruby Padrino合作我已经开始了一项使用rails的新工作。我已经运行捆绑安装,但nokogiri导致问题。我之前看到过这种情况,但我似乎无法找到适合我的解决方案。我的ruby版本是2.3.0p0

Fetching gem metadata from https://repo.fury.io/projectname/....
Fetching version metadata from https://repo.fury.io/projectname/...
Fetching dependency metadata from https://repo.fury.io/projectname/..
Fetching gem metadata from https://repo.fury.io/projectname/....
Fetching gem metadata from http://rubygems.org/
Fetching version metadata from https://repo.fury.io/projectname/...
Fetching version metadata from http://rubygems.org/
Fetching dependency metadata from https://repo.fury.io/projectname/..
Fetching dependency metadata from http://rubygems.org/
Resolving dependencies.....
Using rake 11.1.2
Using Ascii85 1.0.2
Using i18n 0.6.11
Using multi_json 1.12.1
Using builder 3.0.4
Using erubis 2.7.0
Using journey 1.0.4
Using rack 1.4.7
Using hike 1.2.3
Using tilt 1.4.1
Using mime-types 1.25.1
Using polyglot 0.3.5
Using arel 3.0.3
Using tzinfo 0.3.49
Using hashie 2.1.2
Using httpclient 2.8.0
Using rubyntlm 0.3.4
Installing nokogiri 1.5.11 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/vagrant/.rvm/gems/ruby-2.3.0/gems/nokogiri-1.5.11/ext/nokogiri
/home/vagrant/.rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160616-7798-pz83it.rb extconf.rb --use-system-libraries
checking for libxml/parser.h... no
-----
libxml2 is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** 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/vagrant/.rvm/rubies/ruby-2.3.0/bin/$(RUBY_BASE_NAME)
        --with-zlib-dir
        --without-zlib-dir
        --with-zlib-include
        --without-zlib-include=${zlib-dir}/include
        --with-zlib-lib
        --without-zlib-lib=${zlib-dir}/lib
        --with-iconv-dir
        --without-iconv-dir
        --with-iconv-include
        --without-iconv-include=${iconv-dir}/include
        --with-iconv-lib
        --without-iconv-lib=${iconv-dir}/lib
        --with-xml2-dir
        --without-xml2-dir
        --with-xml2-include
        --without-xml2-include=${xml2-dir}/include
        --with-xml2-lib
        --without-xml2-lib=${xml2-dir}/lib
        --with-xslt-dir
        --without-xslt-dir
        --with-xslt-include
        --without-xslt-include=${xslt-dir}/include
        --with-xslt-lib
        --without-xslt-lib=${xslt-dir}/lib
        --with-libxslt-config
        --without-libxslt-config
        --with-pkg-config
        --without-pkg-config
        --with-libxml-2.0-config
        --without-libxml-2.0-config
        --with-libiconv-config
        --without-libiconv-config

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/vagrant/.rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.5.11/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/vagrant/.rvm/gems/ruby-2.3.0/gems/nokogiri-1.5.11 for inspection.
Results logged to /home/vagrant/.rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.5.11/gem_make.out
Using nori 2.3.0
Using adapter-payment-bh 0.2.14.rc1
Using adapter-payment-gig 0.1.6.rc10
Using adapter-payment-jo 0.0.7
Using adapter-payment-kw 0.8.7
Using adapter-payment-pl 0.1.15
Using ruby-ole 1.2.11.8
Using addressable 2.4.0
Using afm 0.2.2
Using alacrity-core_ext 0.2.11
Using dalli 1.0.2
Installing libxml-ruby 2.9.0 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/vagrant/.rvm/gems/ruby-2.3.0/gems/libxml-ruby-2.9.0/ext/libxml
/home/vagrant/.rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160616-7798-19vchc5.rb extconf.rb
checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no
*** 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/vagrant/.rvm/rubies/ruby-2.3.0/bin/$(RUBY_BASE_NAME)
        --with-xml2-config
        --without-xml2-config
        --with-xml2-dir
        --without-xml2-dir
        --with-xml2-include
        --without-xml2-include=${xml2-dir}/include
        --with-xml2-lib
        --without-xml2-lib=${xml2-dir}/lib
 extconf failure: need libxml2.

    Install the library or try one of the following options to extconf.rb:

      --with-xml2-config=/path/to/xml2-config
      --with-xml2-dir=/path/to/libxml2
      --with-xml2-lib=/path/to/libxml2/lib
      --with-xml2-include=/path/to/libxml2/include


To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/vagrant/.rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/libxml-ruby-2.9.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/vagrant/.rvm/gems/ruby-2.3.0/gems/libxml-ruby-2.9.0 for inspection.
Results logged to /home/vagrant/.rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/libxml-ruby-2.9.0/gem_make.out
Using audited 3.0.0
Using currencies 0.4.2
Using daemons 1.2.3
Using bcrypt 3.1.11
Using orm_adapter 0.5.0
Using json 1.8.3
Using thor 0.19.1
Using multi_xml 0.5.5
Using ipaddress 0.8.3
Using valuable 0.9.12
Using state_machine 1.2.0
Using ast 2.2.0
Using json_pure 1.8.3
Using thread_safe 0.3.5
Using ice_nine 0.11.2
Using htmlentities 4.3.4
Using rubyzip 1.0.0
Using beaneater 1.0.0
Using coderay 1.1.1
Using debug_inspector 0.0.2
Using bundler 1.12.5
Using sass 3.4.22
Using bootstrap-select-rails 1.3.0.1
Using brakeman 3.3.0
Using bson 4.1.1
Using bson_ext 1.5.1
Using cancan 1.6.10
Using net-ssh 3.1.1
Using chartkick 1.2.5
Using ffi 1.9.10
Using coffee-script-source 1.10.0
Using execjs 2.7.0
Using chunky_png 1.3.5
Using rb-fsevent 0.9.7
Using chronic 0.10.2
Using clickatell 0.8.2
Using equalizer 0.0.11
Using colored 1.2
Using country-select 1.1.1
Using database_cleaner 1.0.1
Using diff-lcs 1.2.5
Using eventmachine 1.2.0.1
Using ffaker 1.18.0
Using formatador 0.2.5
Using gravatarify 3.1.1
Using ruby_dep 1.3.1
Using lumberjack 1.0.10
Using nenv 0.3.0
Using shellany 0.0.1
Using method_source 0.8.2
Using slop 3.6.0
Using rspec-core 2.14.8
Using rspec-mocks 2.14.6
Using hashery 2.1.2
Using highline 1.6.21
Using ice_cube 0.11.3
Using iconv 1.0.4
Using kgio 2.10.0
Using libv8 3.16.14.15
Using logstash-event 1.2.02
Using stud 0.0.22
Using request_store 1.3.1
Using syntax 1.2.1
Using subexec 0.2.3
Using modernizr-rails 2.7.1
Using sixarm_ruby_unaccent 1.1.1
Using nested_form 0.3.2
Using newrelic_rpm 3.15.2.317
Using ruby-rc4 0.1.5
Using ttfunk 1.0.3
Installing pg 0.18.4 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/vagrant/.rvm/gems/ruby-2.3.0/gems/pg-0.18.4/ext
/home/vagrant/.rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160616-7798-1qv1ynk.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/vagrant/.rvm/rubies/ruby-2.3.0/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/vagrant/.rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/pg-0.18.4/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/vagrant/.rvm/gems/ruby-2.3.0/gems/pg-0.18.4 for inspection.
Results logged to /home/vagrant/.rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/pg-0.18.4/gem_make.out
Using power_assert 0.3.0
Using rainbow 2.1.0
Using raindrops 0.16.0
Using recaptcha 0.3.6
Using ref 2.0.0
Installing rmagick 2.15.4 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/vagrant/.rvm/gems/ruby-2.3.0/gems/rmagick-2.15.4/ext/RMagick
/home/vagrant/.rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160616-7798-1sqod41.rb extconf.rb
checking for gcc... yes
checking for Magick-config... no
checking for pkg-config... yes
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
checking for outdated ImageMagick version (<= 6.4.9)... *** 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/vagrant/.rvm/rubies/ruby-2.3.0/bin/$(RUBY_BASE_NAME)

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/vagrant/.rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/rmagick-2.15.4/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/vagrant/.rvm/gems/ruby-2.3.0/gems/rmagick-2.15.4 for inspection.
Results logged to /home/vagrant/.rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/rmagick-2.15.4/gem_make.out
Using ruby-hmac 0.4.0
Using syslogger 1.6.4
Using unf_ext 0.0.7.2
Using uuidtools 2.1.5
Using annotate 2.5.0
Using activesupport 3.2.22.2
Using gyoku 1.1.1
Using rack-cache 1.6.1
Using rack-test 0.6.3
Using rack-ssl 1.3.4
Using warden 1.2.6
Using sprockets 2.2.3
Using haml 4.0.7
Using treetop 1.4.15
Using httpi 2.1.1
An error occurred while installing nokogiri (1.5.11), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.5.11'` succeeds before bundling.

任何帮助都将不胜感激。

1 个答案:

答案 0 :(得分:1)

Nokogiri需要一个libxml2包。

FOR LINUX / DEBIAN

要安装大多数commom rails依赖项,请运行以下命令:

sudo apt-get install libxml2-dev git curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev

或者您可以使用RVM来安装ruby版本和您的依赖性。

FOR WINDOWS

http://www.railsinstaller.org/

只需下载安装程序并运行。

希望它有所帮助。