Ruby and gem version compatibility

1k views Asked by At

I had an SSH-session to some Ubuntu Server. The latest available Ruby package with -full was an apt-get install ruby1.9.1-full. But after apt-get install rubygems1.9.1 the problem was that:

root@...:~# gem install nokogiri
ERROR:  Error installing nokogiri:
    nokogiri requires Ruby version >= 1.9.2

And I didn't know, which version of Nokogiri I had to install. I tried to guess:

root@...:~# gem install nokogiri -v 1.5.10
Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

..........bla..bla..bla...

and had to switch to RVM way (there I had 1.9.3 and no further problems with gems I needed).

But anyway I prefer non-RVM way, so the question is: How do I know, which version of the gem is compatible with my Ruby?

1

There are 1 answers

0
Arie Xiao On

Inspecting from the CHANGLOG.rdoc of Nokogiri in its source:

1.6.0.rc1 / 2013-04-14

This release was based on v1.5.9, and so does not contain any fixes mentioned in the notes for v1.5.10.

   Notes

       mini_portile is now a runtime dependency

       Ruby 1.9.2 and higher now required

   Features

       (MRI) Source code for libxml 2.8.0 and libxslt 1.2.26 is packaged with the gem. These libraries are compiled at gem install time unless the environment variable NOKOGIRI_USE_SYSTEM_LIBRARIES is set. VERSION_INFO (also `nokogiri -v`) exposes whether libxml was compiled from packaged source, or the system library was used.

       (Windows) libxml upgraded to 2.8.0

   Deprecations

       Support for Ruby 1.8.7 and prior has been dropped

You may give the previous version a try, say 1.5.10 / 2013-06-07

For the errors of building native extension, you shall check the build log of Nokogiri. It's likely that your system missed some library dependencies, such as libxml, libyaml, etc. RVM may handle the dependency for you, in its manner, so you don't get error while building with RVM.