简体   繁体   English

Nokogiri gem无法安装

[英]Nokogiri gem failing to install

I'm trying to install nokogiri v 1.6.7.2 in a new rails project. 我正在尝试在新的Rails项目中安装nokogiri v 1.6.7.2。 I'm running Kali Linux (debian-based). 我正在运行Kali Linux(基于Debian)。 Here is the stack trace: 这是堆栈跟踪:

    $ gem install nokogiri -v '1.6.7.2' -- --use-system-libraries
Building native extensions with: '--use-system-libraries'
This could take a while...
ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

    /usr/bin/ruby2.2 -r ./siteconf20160405-3609-rdkvif.rb extconf.rb --use-system-libraries
checking if the C compiler accepts ... yes
Building nokogiri using system libraries.
libxml2 version 2.6.21 or later is required!
*** 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=/usr/bin/$(RUBY_BASE_NAME)2.2
    --help
    --clean
    --use-system-libraries
    --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-xml2-dir
    --without-xml2-dir
    --with-xml2-include
    --without-xml2-include=${xml2-dir}/include
    --with-xml2-lib
    --without-xml2-lib=${xml2-dir}/lib
    --with-libxml-2.0-config
    --without-libxml-2.0-config
    --with-pkg-config
    --without-pkg-config
    --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-exslt-dir
    --without-exslt-dir
    --with-exslt-include
    --without-exslt-include=${exslt-dir}/include
    --with-exslt-lib
    --without-exslt-lib=${exslt-dir}/lib
    --with-libexslt-config
    --without-libexslt-config
    --with-pkg-config
    --without-pkg-config

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.2.0/gems/nokogiri-1.6.7.2 for inspection.
Results logged to /var/lib/gems/2.2.0/extensions/x86_64-linux/2.2.0/nokogiri-1.6.7.2/gem_make.out

I've checked I have libxml2 installed: 我检查了我是否安装了libxml2:

apt-get install libxml2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libxml2 is already the newest version (2.9.3+dfsg1-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

And I saw in other threads to try using the --use-sytem-libraries flag, but that still causes the same error. 而且我在其他线程中看到尝试使用--use-sytem-libraries标志,但这仍然会导致相同的错误。 What am I missing? 我想念什么?

Thank you! 谢谢!

In addition to libxml2 and libxslt , you also require some additional development libraries. 除了libxml2libxslt ,您还需要一些其他开发库。 Install them using sudo apt-get install ruby-dev zlib1g-dev liblzma-dev . 使用sudo apt-get install ruby-dev zlib1g-dev liblzma-dev安装它们。 More at https://github.com/sparklemotion/nokogiri.org-tutorials/blob/master/content/installing_nokogiri.md . 有关更多信息, 请参见https://github.com/sparklemotion/nokogiri.org-tutorials/blob/master/content/installing_nokogiri.md

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM