在尝试使用下面的宝石:RESTClient实现抛出异常异常
require 'nokogiri'
require 'restclient'
require 'mechanize'
,我发现了以下错误:
C:/Ruby23/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- ffi_c (LoadError)
from C:/Ruby23/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/ffi-1.9.10-x86-mingw32/lib/ffi.rb:6:in `rescue in <top (required)>'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/ffi-1.9.10-x86-mingw32/lib/ffi.rb:3:in `<top (required)>'
from C:/Ruby23/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/Ruby23/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/rest-client-1.8.0-x86-mingw32/lib/restclient/windows/root_certs.rb:2:in `<top (required)>'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/rest-client-1.8.0-x86-mingw32/lib/restclient/windows.rb:7:in `require_relative'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/rest-client-1.8.0-x86-mingw32/lib/restclient/windows.rb:7:in `<top (required)>'
from C:/Ruby23/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/Ruby23/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/rest-client-1.8.0-x86-mingw32/lib/restclient.rb:16:in `<top (required)>'
from C:/Ruby23/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in `require'
from C:/Ruby23/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
from C:/Ruby23/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from parse_docs.rb:5:in `<main>'
由于这个名单上的最后一件事是5号线,这是require 'restclient'
我猜它与此有关?不过,我已经尝试做到以下几点:
由于
restclient
已被弃用,并已转移到rest-client
,我尝试使用rest-client
但不工作,并产生同样的错误。我也试图
require 'rubygems'
,但是当我运行该程序时,它不会允许我继续并产生相同的错误。所以我完全拿掉了
restclient
,这就是我如何得到restclient
导致问题的想法,因为如果没有它,程序可以成功运行。所以我虽然会发生什么,如果我回滚
ffi
?所以我安装了运行restclient
所需的ffi
版本。但是,这也没有帮助。更新了我所有的宝石,还抛出了同样的错误..
下载上
ffi
最新版本,没有什么变化,但现在我在我的系统上havea的ffi
新版本,这仍然抛出一个错误时正在与restclient
为什么restclient
生产ffi
错误使用,我以前从来没有这种事发生在我身上。 rest-client
已弃用?还是有一个简单的解决方案,我不赶上?我研究过这个,没有人有这个问题(使用restclient
时),但是有很多人在使用其他宝石时得到这个错误。例如,另请参阅here。也许值得一提的是,我正在运行Windows 7.
有没有人知道这些信息? – 13aal
如果可以,请尝试使用ruby 2.2。目前,ruby 2.3似乎是[不支持的](https://github.com/ffi/ffi/issues/500)。 – rdupz