我正在使用Spreadsheet GEM来解析我的Ruby / Watir项目的excel文件。我有所有必要的宝石,如下面的宝石列表所示:
*本地宝石*
archive-tar-minitar (0.5.2)
builder (3.2.2)
bundler (1.5.2)
childprocess (0.4.0)
columnize (0.3.6)
cucumber (1.3.10)
data_magic (0.17)
dbi (0.4.5)
debugger-ruby_core_source (1.3.1)
deprecated (3.0.1, 2.0.1)
diff-lcs (1.2.5)
faker (1.2.0)
ffi (1.9.3 x86-mingw32)
gherkin (2.12.2 x86-mingw32)
i18n (0.6.9)
minitest (5.2.2)
multi_json (1.8.4)
multi_test (0.0.3)
page-object (0.9.5)
page_navigation (0.9)
rake (10.1.1)
rdoc (2.5.8)
require_all (1.3.2)
rspec (2.14.1)
rspec-core (2.14.7)
rspec-expectations (2.14.5)
rspec-mocks (2.14.5)
ruby-ole (1.2.11.7)
ruby_core_source (0.1.5)
rubygems-update (2.2.1)
rubyzip (1.1.0)
selenium-webdriver (2.39.0)
spreadsheet (0.9.7)
test-unit (2.5.5)
testgen (0.8.5)
thor (0.18.1)
tiny_tds (0.6.1 x86-mingw32)
watir-webdriver (0.6.6)
websocket (1.1.2, 1.0.7)
win32console (1.3.2 x86-mingw32)
yml_reader (0.2)
我仍然获得:
no such file to load -- spreadsheet (LoadError)
C:/Users/ppai/Desktop/Cucumber Watir/demo (2)/demo/features/step_definitions/Function.rb:4:in `require'
C:/Users/ppai/Desktop/Cucumber Watir/demo (2)/demo/features/step_definitions/Function.rb:4:in `<top (required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.3.10/lib/cucumber/rb_support/rb_language.rb:122:in `load'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.3.10/lib/cucumber/rb_support/rb_language.rb:122:in `load_code_file'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.3.10/lib/cucumber/runtime/support_code.rb:180:in `load_file'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.3.10/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.3.10/lib/cucumber/runtime/support_code.rb:82:in `each'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.3.10/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.3.10/lib/cucumber/runtime.rb:184:in `load_step_definitions'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.3.10/lib/cucumber/runtime.rb:42:in `run!'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.3.10/lib/cucumber/cli/main.rb:47:in `execute!'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.3.10/bin/cucumber:13:in `<top (required)>'
C:/Ruby192/bin/cucumber:23:in `load'
C:/Ruby192/bin/cucumber:23:in `<main>'
当我运行代码时:
require 'rubygems'
require 'win32ole'
require 'watir-webdriver'
require "spreadsheet"
Spreadsheet.client_encoding = 'UTF-8'
book = Spreadsheet::Workbook.new
book = Spreadsheet.open 'C:\\Users\\mndd\\Desktop\\Cucumber\\Watir\\demo (2)\\demo\\Test.xls'
我有相同错误的先前查询的所有解决方案(更新Gems,重新安装电子表格GEM等),但无法解决它。我做错了什么?