Error installing nokogiri on ubuntu 14.0.4 (Ruby 1.8.7)

I am trying to install a package (bundle install), Ruby 1.8.7 is installed in Ubuntu 14.0.4. And he cannot install the package and throws an error:

An error occurred while installing nokogiri (1.4.7), and Bundler cannot
continue. Make sure that 'gem install nokogiri -v '1.4.7'' succeeds before bundling.

so now i tried to get nokogiri 1.4.7 s but this failed showed

$ sudo gem install nokogiri -v '1.4.7'
ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.
libxml2 is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.

so I tried again to get this libxml2, but ended up getting the following message:

$ sudo gem install libxml2
ERROR:  Could not find a valid gem 'libxml2' (>= 0) in any repository
ERROR:  Possible alternatives: libxml4r


$ sudo gem install libxml4r
ERROR:  Error installing libxml4r
extconf failure: need libxml2.

I tried with the link :

$ gem install nokogiri -- --use-system-libraries
$ bundle install

but still the same nokogiri mistake coming again. I have no idea how to proceed. Help me please!!!!

+10
source share
7 answers

I tried the following commands, and I succeeded. Thanks Mr.Kumar

$ sudo apt-get update 
$ sudo apt-get install libxml2-dev
$ sudo apt-get install libxslt-dev
$ sudo gem install nokogiri -v '1.4.7'

$ gem list nokogiri
*** LOCAL GEMS ***
nokogiri (1.4.7)
+12
source

. $ sudo apt-get install zlib1g-dev

+11

( ).

sudo apt-get update 

libxml2.

sudo apt-get install libxml2-dev
+8

After all of the above and receiving an error message, that worked for me using the package configuration assembly with system libraries :

bundle config build.nokogiri --use-system-libraries
bundle install

Hope it helps! :)

+3
source
$ sudo apt-get update
$ sudo apt-get install libxml2-dev
$ sudo gem install nokogiri --version 1.8.0

It's all.

+1
source

On an Ubuntu server, I also had to install zlib1g-dev:

$ sudo apt-get install zlib1g-dev
0
source

I had the same issue on Ubuntu 18.04 and the launch helped me sudo apt-get install ruby-dev.

0
source

All Articles