另见here
在执行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
?我正在运行Windows 7。
答案 0 :(得分:2)
这适用于运行Ruby版本的Windows 7用户:ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]
或更高版本,尝试安装mechanize gem
如果您在安装nokogiri
和mechanize
时遇到问题,请在此处成功解决。
首先安装
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
的版本,但我是不确定那是不是我的系统。
这是我发现的唯一解决方法,以便安装mechanize
和nokogiri
,如果您遇到问题请告诉我,以便我可以找到进一步的解决方案问题