导轨 - 安装使用RubyGems的电子表格宝石收到错误(Rails - getting error

2019-09-18 00:07发布

我希望能够应对在轨Excel中spreadhseets。
所以,我使用的是spreadsheet库。
然而,当我使用RubyGems的安装电子表格,我得到一个异常:

Successfully installed spreadsheet-0.7.1
1 gem installed
Installing ri documentation for spreadsheet-0.7.1...
unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK
for lib/spreadsheet/excel/internals.rb, skipping
unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK
for lib/spreadsheet/excel/reader/biff8.rb, skipping
unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK
for lib/spreadsheet/excel/reader.rb, skipping
unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK
for lib/spreadsheet/excel/writer/biff8.rb, skipping
unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK
for lib/spreadsheet/excel/writer/format.rb, skipping
unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK
for lib/spreadsheet/excel/writer/n_worksheet.rb, skipping
unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK
for lib/spreadsheet/excel/writer/workbook.rb, skipping
unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK
for lib/spreadsheet/excel/writer/worksheet.rb, skipping
Installing RDoc documentation for spreadsheet-0.7.1...
unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK
for lib/spreadsheet/excel/internals.rb, skipping
unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK
for lib/spreadsheet/excel/reader/biff8.rb, skipping
unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK
for lib/spreadsheet/excel/reader.rb, skipping
unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK
for lib/spreadsheet/excel/writer/biff8.rb, skipping
unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK
for lib/spreadsheet/excel/writer/format.rb, skipping
unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK
for lib/spreadsheet/excel/writer/n_worksheet.rb, skipping
unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK
for lib/spreadsheet/excel/writer/workbook.rb, skipping
unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK
for lib/spreadsheet/excel/writer/worksheet.rb, skipping`

然后在我的doSomethingController,我写的代码:

require 'spreadsheet'

但服务器返回错误

cannot load such file -- spreadsheet

你能帮助我弄清楚发生了什么以及如何解决异常

我的环境:

ruby 1.9.3
rubygem 1.8.16

Answer 1:

检查你的宝石:

gem list

检查是否有一个正在安装:

gem list | grep spreadsheet 

按照使用说明在http://rubygems.org/gems/spreadsheet也谈到发展依赖关系:

hoe ~> 2.13   
rdoc ~> 3.10  

有一个伟大的“入门”指南在http://spreadsheet.rubyforge.org/files/GUIDE_txt.html

维基- http://spreadsheet.ch/也很有用。



文章来源: Rails - getting errors installing the spreadsheet gem using rubygems