libxslt is missing while installing ruby gem nokogiri
Asked Answered
N

6

15

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?

Nickola answered 18/4, 2013 at 13:20 Comment(0)
Q
14

Try Nokogiri 1.6.0.rc1, which bundles libxml2 and libxslt in the gem. This should address your installation problem:

gem install nokogiri --pre

should do the trick.

Quinquefid answered 23/4, 2013 at 20:50 Comment(2)
What about a gem that depends on nokogiri 1.5.x?Metrology
aws-sdk (~> 1.24.0) ruby depends on nokogiri (< 1.6.0, >= 1.4.4) ruby . :( this is like the third time I go through this same problem. Usually my solving procedure means trying a lot of stuff until one works.Dud
M
40

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")

Mccombs answered 18/4, 2013 at 13:38 Comment(2)
Nokogiri github page no longer references this, but when setting up a dev environment for an old project. However, your answer was exactly what I needed.Doxia
@Doxia Thank you. I have restored the first link.Mccombs
Q
14

Try Nokogiri 1.6.0.rc1, which bundles libxml2 and libxslt in the gem. This should address your installation problem:

gem install nokogiri --pre

should do the trick.

Quinquefid answered 23/4, 2013 at 20:50 Comment(2)
What about a gem that depends on nokogiri 1.5.x?Metrology
aws-sdk (~> 1.24.0) ruby depends on nokogiri (< 1.6.0, >= 1.4.4) ruby . :( this is like the third time I go through this same problem. Usually my solving procedure means trying a lot of stuff until one works.Dud
P
11

Try installing dependencies

sudo apt-get install libxslt-dev libxml2-dev
Peripeteia answered 22/4, 2014 at 8:0 Comment(0)
H
11

Maybe this will be helpful for other people: If you recieve error:


libxslt is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.

you need to install also the devel version of libxslt apt-get install libxslt-dev or in CentOS

yum install libxslt-devel

Hurff answered 11/9, 2015 at 14:42 Comment(1)
Thanks, dude! You saved my day.Pasquinade
V
1

Choose and Install suitable library from below as per your Linux flavor:-

  • deb: libxslt1-dev (Debian, Ubuntu, etc)
  • rpm: libxslt-devel (Fedora, CentOS, RHEL)
  • csw: libxslt_dev (Solaris)

Install with an appropriate command like apt-get, yum, etc.

Visional answered 17/8, 2019 at 18:48 Comment(0)
J
0

If you want to install a previous version of nokogiri, installing Nokogiri 1.6.0.rc1 would not do the trick.

You must install the libxslt separetly:

sudo apt-get install libxslt-dev libxml2-dev

After that run again your command: (in my case)

gem install nokogiri -v '1.5.11'

Jarmon answered 4/2, 2015 at 15:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.