I recognize that this is a duplicate question however all the other answers I've found related to this issue have not seemed to help me...
I'm installing GitLab
and running through the gem dependencies when it hits the NokoGiri
gem requirement and fails with the following info:
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
extconf.rb:10:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
extconf.rb:10:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
extconf.rb:11:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... yes
checking for xmlParseDoc()... -lxml2
checking for xsltParseStylesheetDoc()... -lxslt
-----
libxslt is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
So, this error leads me down the path of attempting to install libxslt
with the following command:
$ sudo apt-get install libxslt-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libxslt1-dev' instead of 'libxslt-dev'
libxslt1-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 146 not upgraded.
So what gives? NokoGiri is needing this package, but the package is already installed!! I can't seem to get past this issue, any help out there?
Solution. Uninstall all versions of Nokogiri on your system, and then re-resolve your dependencies (using bundle or gem install ). This error can occur when a version of Nokogiri installed for a different version of Ruby is used by an unsupported version of Ruby.
One of the best gems for Ruby on Rails is Nokogiri which is a library to deal with XML and HTML documents. The most common use for a parser like Nokogiri is to extract data from structured documents.
The Nokogiri gem is an incredible open-source tool that parses HTML and XML data. It is one of the most widely used gems available, and it can really take your Ruby app to another level for data with its ability to help you intuitively scrape websites.
Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby. It provides a sensible, easy-to-understand API for reading, writing, modifying, and querying documents. It is fast and standards-compliant by relying on native parsers like libxml2 (C) and xerces (Java).
first make sure you have all the dependencies, as mentioned in "Installing Nokogiri with RVM on Ubuntu" (which mentions the very same error message)
I have no idea why it can't find the package "libxslt". Instead of worrying about that, I'm going to install the dependencies listed on Nokogiri GitHub page:
$ sudo apt-get install libxslt-dev libxml2-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libxslt1-dev' instead of 'libxslt-dev'
libxslt1-dev is already the newest version.
libxml2-dev is already the newest version.
That appears to have worked well enough, so I press on. The next step is install the actual Nokogiri gem. The instructions say to use "sudo gem install nokogiri", but because I'm using RVM, I drop the "sudo" part:
$ gem install nokogiri
Considering "Fresh install of RVM in Ubuntu isn't letting me install gems (zlib error)", since you have libxslt1-dev
(and not libxslt-dev
), you might considering recompiling your ruby.
(a bit like in "How to get Readline support in IRB using RVM on Ubuntu 11.10")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With