1

我有一个到一些 Ubuntu 服务器的 SSH 会话。最新可用的 Ruby 包-full是一个apt-get install ruby1.9.1-full. 但之后apt-get install rubygems1.9.1的问题是:

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

而且我不知道我必须安装哪个版本的 Nokogiri。我试着猜测:

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...

并且不得不切换到 RVM 方式(我有 1.9.3 并且我需要的宝石没有进一步的问题)。

但无论如何我更喜欢非 RVM 方式,所以问题是:我怎么知道哪个版本的 gem 与我的 Ruby 兼容?

4

1 回答 1

1

Nokogiri的 CHANGLOG.rdoc 的源代码中进行检查:

1.6.0.rc1 / 2013-04-14

此版本基于 v1.5.9,因此不包含 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

你可以试试以前的版本,比如1.5.10 / 2013-06-07

对于构建原生扩展的错误,您应该检查 Nokogiri 的构建日志。您的系统很可能错过了一些库依赖项,例如 libxml、libyaml 等。RVM 可能会以它的方式为您处理依赖项,因此您在使用 RVM 构建时不会出错。

于 2013-08-13T12:50:45.473 回答