Hardik Joshi
Hardik Joshi

Reputation: 849

unable to install nokogiri in ubuntu 12.04

I am trying to setup rails env on my new ubuntu machine. But I am facing trouble while install nokogiri gem.. I have installed libxslt and libxml2 libs thourgh rvm pkg command as well as using apt-get. I thought it is showing me libxslt is missing error.

Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

        /home/hacker5/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb --with-xslt-include=/usr/include/libxslt
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... no
checking for iconv_open() in -liconv... yes
checking for xmlParseDoc() in -lxml2... yes
checking for xsltParseStylesheetDoc() in -lxslt... no
-----
libxslt is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----

EDIT

I am using rvm setup and ruby 1.9.3

Upvotes: 15

Views: 11805

Answers (8)

worldask
worldask

Reputation: 1837

for Centos / Redhat, try this: sudo yum install libxslt-devel libxml2-devel

Upvotes: 1

Hiccup
Hiccup

Reputation: 51

On 14.0.4, using RVM, you need:

sudo apt-get install -y libgmp-dev

Upvotes: 5

Benjamin Tan Wei Hao
Benjamin Tan Wei Hao

Reputation: 9691

Try this:

# nokogiri requirements
sudo apt-get install libxslt-dev libxml2-dev
gem install nokogiri

Upvotes: 24

Dan
Dan

Reputation: 21

apt-get install libxslt-dev libxml2-dev -y && export NOKOGIRI_USE_SYSTEM_LIBRARIES=1 && gem install --verbose nokogiri

Upvotes: 2

user2713480
user2713480

Reputation:

this is what worked for me:

  1. install nokogiri's dependencies

    sudo apt-get install libxslt-dev libxml2-dev

  2. make sure nokogiri uses the system libraries

    export NOKOGIRI_USE_SYSTEM_LIBRARIES=1

  3. install nokogiri with the --verbose option, to get a better understanding of any problems

    gem install --verbose nokogiri

Upvotes: 9

tokhi
tokhi

Reputation: 21618

Install ruby via rvm and then install below libs:

sudo apt-get install libxslt-dev libxml2-dev

now try to install gem without sudo:

gem install nokogiri

Upvotes: 2

rdsoze
rdsoze

Reputation: 1768

For Ruby 1.9.3 and 2.0, libxslt-dev and libxml2-dev are required.

sudo apt-get install libxslt-dev libxml2-dev

Upvotes: 10

ntwrkguru
ntwrkguru

Reputation: 1754

Since I stumbled upon this, here's what I did to resolve:

sudo apt-get install ruby1.9.1-dev

Upvotes: 6

Related Questions