如何安装Nokogiri?

时间:2015-06-20 18:36:48

标签: ruby nokogiri

我安装了所有库(linux),但它还不能用,为什么?

gem install nokogiri -- --with-xml2-include=/home/mka/.linuxbrew/Cellar/libxml2/2.9.2/include/libxml2 --with-xml2-lib=/home/mka/.linuxbrew/Cellar/libxml2/2.9.2/lib --with-xslt-dir=/home/mka/.linuxbrew/Cellar/libxslt/1.1.28_1 --with-iconv-include=/home/mka/.linuxbrew/Cellar/libiconv/1.14/include --with-iconv-lib=/home/mka/.linuxbrew/Cellar/libiconv/1.14/lib


Building native extensions with: '--with-xml2-include=/home/mka/.linuxbrew/Cellar/libxml2/2.9.2/include/libxml2 --with-xml2-lib=/home/mka/.linuxbrew/Cellar/libxml2/2.9.2/lib --with-xslt-dir=/home/mka/.linuxbrew/Cellar/libxslt/1.1.28_1 --with-iconv-include=/home/mka/.linuxbrew/Cellar/libiconv/1.14/include --with-iconv-lib=/home/mka/.linuxbrew/Cellar/libiconv/1.14/lib'
This could take a while...
ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

    /home/mka/bin/ruby -r ./siteconf20150620-18735-gpygf8.rb extconf.rb --with-xml2-include=/home/mka/.linuxbrew/Cellar/libxml2/2.9.2/include/libxml2 --with-xml2-lib=/home/mka/.linuxbrew/Cellar/libxml2/2.9.2/lib --with-xslt-dir=/home/mka/.linuxbrew/Cellar/libxslt/1.1.28_1 --with-iconv-include=/home/mka/.linuxbrew/Cellar/libiconv/1.14/include --with-iconv-lib=/home/mka/.linuxbrew/Cellar/libiconv/1.14/lib
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
*** 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/mka/bin/$(RUBY_BASE_NAME)
    --help
    --clean
    --use-system-libraries
/home/mka/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- openssl (LoadError)
    from /home/mka/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/mka/lib/ruby/2.2.0/net/https.rb:22:in `<top (required)>'
    from /home/mka/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/mka/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/mka/lib/ruby/gems/2.2.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:3:in `<top (required)>'
    from /home/mka/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
    from /home/mka/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
    from /home/mka/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
    from extconf.rb:395:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /home/mka/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /home/mka/lib/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.0-static/nokogiri-1.6.6.2/gem_make.out

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:4)

尝试使用:gem install nokogiri -- --use-system-libraries

请参阅&#34; Installing Nokogiri&#34;