Unable to gem install nokogiri

最后都变了- 提交于 2019-12-11 01:11:47

问题


When attempting to use gem install nokogiri

I'm getting the following error:

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

However if I do ruby -v:

ruby 2.3.0p0 (2015-12-25 revision 53290) [i386-mingw32]

I've attempted to install it locally, gem install --local nokogiri and it runs through the install process, however when I attempt to use the gem, it won't find the file:

C:/Ruby23/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
: cannot load such file -- nokogiri (LoadError)

Does anyone have a work around for this? Or am I pretty much stuck without nokogiri?


回答1:


I think the answer was staring us in the face, your version of nokogiri requires Ruby less than 2.3, and you're running ruby 2.3.

It seems you're not the only one with this issue: https://github.com/sparklemotion/nokogiri/issues/1456




回答2:


After some hassle and some research, I used gem install nokogiri --pre and wouldn't you know it:

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

I found the answer to this question here I've also looked into it on GitHub (as mentioned by Aaron_H) and it seems that this is only happening on Windows, so if you really need nokogiri you need to do gem install nokogiri --pre in order to get it (on Windows 7 anyways).



来源:https://stackoverflow.com/questions/37234362/unable-to-gem-install-nokogiri

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!