无法gem安装mechanize



另请参见此处

在执行gem install mechanize时,我得到以下错误:

ERROR:  Error installing mechanize:
        nokogiri requires Ruby version < 2.3, >= 1.9.2.

然而,在你把这归结为我是个白痴,不知道自己在做什么之前,如果我运行nokogiri -v,我会得到这个:

# Nokogiri (1.6.8.rc3)
    ---
    warnings: []
    nokogiri: 1.6.8.rc3
    ruby:
      version: 2.3.0
      platform: i386-mingw32
      description: ruby 2.3.0p0 (2015-12-25 revision 53290) [i386-mingw32]
      engine: ruby
    libxml:
      binding: extension
      source: packaged
      libxml2_path: "/home/flavorjones/code/oss/nokogiri/ports/i686-w64-mingw32/libxml
2/2.9.3"
      libxslt_path: "/home/flavorjones/code/oss/nokogiri/ports/i686-w64-mingw32/libxsl
t/1.1.28"
      libxml2_patches: []
      libxslt_patches:
      - 0001-Adding-doc-update-related-to-1.1.28.patch
      - 0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch
      - 0003-Initialize-pseudo-random-number-generator-with-curre.patch
      - 0004-EXSLT-function-str-replace-is-broken-as-is.patch
      - 0006-Fix-str-padding-to-work-with-UTF-8-strings.patch
      - 0007-Separate-function-for-predicate-matching-in-patterns.patch
      - 0008-Fix-direct-pattern-matching.patch
      - 0009-Fix-certain-patterns-with-predicates.patch
      - 0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch
      - 0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch
      - 0014-Fix-for-bug-436589.patch
      - 0015-Fix-mkdir-for-mingw.patch
      - 0016-Fix-for-type-confusion-in-preprocessing-attributes.patch
      - 0017-Updated-config.guess.patch
      compiled: 2.9.3
      loaded: 2.9.3

很明显,nokogiri已经安装好了,因为我花了大约三个小时才安装好。有没有办法让我包括这个版本的nokogiri?我运行的是Windows7。

这适用于运行Ruby版本:ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]或更高版本的Windows 7用户,尝试安装mechanize gem


如果您在安装nokogirimechanize时遇到问题,以下是成功安装的方法。

首先安装nokogiri的早期版本:gem install nokogiri --pre

你的输出看起来像这样:

Fetching: nokogiri-1.6.8.rc3-x86-mingw32.gem (100%)
Nokogiri is built with the packaged libraries: libxml2-2.9.3, libxslt-1.1.28, zlib-1.2
.8, libiconv-1.14.
Successfully installed nokogiri-1.6.8.rc3-x86-mingw32
Parsing documentation for nokogiri-1.6.8.rc3-x86-mingw32
Installing ri documentation for nokogiri-1.6.8.rc3-x86-mingw32
Done installing documentation for nokogiri after 12 seconds
1 gem installed

成功安装后,安装nokogiri版本1.6:gem install nokogiri -v 1.6

输出将如下所示:

Fetching: mini_portile-0.5.3.gem (100%)
Successfully installed mini_portile-0.5.3
Fetching: nokogiri-1.6.0-x86-mingw32.gem (100%)
Successfully installed nokogiri-1.6.0-x86-mingw32
Parsing documentation for mini_portile-0.5.3
Installing ri documentation for mini_portile-0.5.3
Parsing documentation for nokogiri-1.6.0-x86-mingw32
Installing ri documentation for nokogiri-1.6.0-x86-mingw32
Done installing documentation for mini_portile, nokogiri after 9 seconds
2 gems installed

最后继续安装mechanize,它会工作的!gem install mechanize

最后,您将安装mechanize

Fetching: mechanize-2.7.4.gem (100%)
Successfully installed mechanize-2.7.4
Parsing documentation for mechanize-2.7.4
Installing ri documentation for mechanize-2.7.4
Done installing documentation for mechanize after 9 seconds
1 gem installed

注释

  • 您可能可以绕过第一部分gem install nokogiri --pre,它不允许我继续,直到已经安装了nokogiri的版本,但我不确定这是否只是我的系统。

  • 这是我发现的安装mechanizenokogiri的唯一解决方法,如果您遇到问题,请告诉我,这样我就可以找到进一步的解决方案。

相关内容

  • 没有找到相关文章

最新更新