本文介绍了Ruby roo LoadError:无法加载此类文件——电子表格/注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试加载 xls 文件并出现此错误.有控制台日志:

Try load xls file and get this error. There is console log:

irb(main):001:0> require 'roo'
=> true
irb(main):002:0> a = Roo::Excel.new('/home/a.xls')
LoadError: cannot load such file -- spreadsheet/note
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /var/lib/gems/1.9.1/gems/spreadsheet-0.9.2/lib/spreadsheet/excel/reader.rb:5:in     `<top (required)>'
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /var/lib/gems/1.9.1/gems/spreadsheet-0.9.2/lib/spreadsheet.rb:28:in `<top (required)>'
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /var/lib/gems/1.9.1/gems/roo-1.12.2/lib/roo/excel.rb:1:in `<top (required)>'
    from (irb):2
    from /usr/bin/irb:12:in `<main>'

请帮忙解决这个问题

此外,当我尝试需要电子表格时,我也遇到了同样的错误

Also when I try require spreadsheet I get the same error

require 'spreadsheet'

但是这个模块是安装的

$ gem list | grep spreadsheet
spreadsheet (0.9.2)

推荐答案

尝试将电子表格"gem 的版本修复为0.9.0".

Try to fix version of "spreadsheet" gem to "0.9.0".

在我的情况下添加

gem "spreadsheet", "0.9.0"

就在 roo gem 诡计之前.

right before roo gem made a trick.

这篇关于Ruby roo LoadError:无法加载此类文件——电子表格/注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 15:14