【问题标题】:Ruby and gem version compatibilityRuby 和 gem 版本兼容性
【发布时间】:2023-03-03 00:51:01
【问题描述】:

我有一个到一些 Ubuntu 服务器的 SSH 会话。带有-full 的最新可用Ruby 包是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 并且我需要的 gem 没有其他问题)。

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

【问题讨论】:

    标签: ruby gem compatibility version-compatibility


    【解决方案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 构建时不会出错。

    【讨论】:

      猜你喜欢
      • 2020-04-23
      • 2022-11-10
      • 2022-01-25
      • 2018-07-10
      • 2018-05-20
      • 2020-02-29
      • 2019-08-27
      • 1970-01-01
      相关资源
      最近更新 更多