2011-11-01 61 views
12

這個問題纏着我了幾天,現在...當我用.bring_to_front方法沒有這樣的文件來加載 - ffi_c(LoadError)

require "rubygems" 
require "watir" 

browser = Watir::Browser::new 
browser.bring_to_front 

我得到這個錯誤:

(...)rubygems/custom_require.rb:36:in `require': no such file to load -- ffi_c (LoadError) 

我試着卸載並重新安裝ffi/watir/ruby​​/netbeans而沒有成功。

管線36 custom_require.rb

def require path 
if Gem.unresolved_deps.empty? or Gem.loaded_path? path then 
    gem_original_require path 
else 
    spec = Gem.searcher.find_active path 
    unless spec then 
    found_specs = Gem.searcher.find_in_unresolved path 
    unless found_specs.empty? then 
     found_specs = [found_specs.last] 
    else 
     found_specs = Gem.searcher.find_in_unresolved_tree path 
    end 
    found_specs.each do |found_spec| 
     Gem.activate_spec found_spec 
    end 
    end 
    return gem_original_require path #problem 
end 

*當地的寶石*

archive-tar-minitar (0.5.2) 
builder (3.0.0) 
childprocess (0.2.2) 
columnize (0.3.4) 
commonwatir (2.0.4) 
ffi (1.0.10 x86-mingw32) 
firewatir (1.9.4, 1.8.1) 
hoe (2.12.3, 2.8.0) 
json (1.6.1) 
json_pure (1.6.1) 
linecache19 (0.5.12) 
minitest (2.7.0, 2.6.2, 1.6.0) 
nokogiri (1.5.0 x86-mingw32) 
rake (0.9.2.2, 0.9.2, 0.8.7) 
rautomation (0.6.3) 
rdiscount (1.6.8) 
rdoc (3.11, 2.5.8) 
require_all (1.2.0) 
ruby-debug-base19 (0.11.25) 
ruby-debug-ide (0.4.16, 0.4.9) 
ruby_core_source (0.1.5) 
rubyzip (0.9.4) 
s4t-utils (1.0.4) 
selenium-webdriver (2.10.0) 
user-choices (1.1.6.1) 
watir (2.0.4) 
watir-webdriver (0.3.5) 
win32-api (1.4.8 x86-mingw32) 
win32-process (0.6.5) 
windows-api (0.4.0) 
windows-pr (1.2.1) 
xml-simple (1.1.1, 1.1.0) 
+1

0)適用於紅寶石1.9.2和Watir 2.0.3 1)您使用的是什麼版本的Watir。 2)我們需要更多的錯誤。指定文件中的第36行使用傳遞給該方法的參數,需要查看該行所在的位置。 3)你可以在命令行中輸入'Gem List',並將這些信息添加到你的問題中。 –

+0

1.紅寶石1.9.2 +的Watir 2.0.4 – drake10k

+0

感謝包括附加信息,但它更實際的錯誤的,我想看看,我已經走了,看着custom_require文件.. –

回答

20

我認爲丟失的文件涉及FFI寶石。我有問題試圖自己使用FFI v1.0.10(當它去安裝,並由於有關webdriver代碼的東西),所以在我的盒子上,我已經安裝了該寶石的v1.0.9。

我說沒有太多的試圖通過推出創業板回一版本丟失。在命令行中鍵入

gem uninstall ffi 

一旦它完成,然後

gem install ffi -v 1.0.9 

看看是否能爲你解決的事情。

更新的FFI創業板自更新過去1.1.0與這些版本似乎很好地工作的Watir和的Watir-webdriver的,但是寶石不是預編譯,並具有當它安裝編譯代碼。這意味着如果你在PC上運行,你需要安裝Ruby開發工具包的Windows,又名'devkit',您可以從downloads page得到它的rubyinstaller網站

下載和安裝的devkit第一,然後打開一個新的命令行窗口,然後使用

gem install ffi 

獲得最新版本的FFI寶石

如果由於某種原因不爲你工作,你總是可以使用上面的原始說明安裝的稍舊版本FFI寶石

+3

你的確是對。這解決了問題。感謝您的幫助。 – drake10k

+1

也爲我工作,謝謝! – holaSenor

+1

非常感謝。有同樣的問題,發現這一點,它也解決了我的問題。 –

相關問題