2010-11-08 87 views
11

当我尝试运行'rails server'时,它给我一个错误,说它找不到'jcode',我认为jcode是默认的ruby库。 你们有什么线索知道发生了什么?运行rails服务器时没有'jcode'gem

/Users/seanfchan/.rvm/gems/[email protected]/gems/gdata-1.1.1/lib/gdata.rb:21:in `require': no such file to load -- jcode (LoadError) 
from /Users/seanfchan/.rvm/gems/[email protected]/gems/gdata-1.1.1/lib/gdata.rb:21:in `<top (required)>' 
from /Users/seanfchan/.rvm/gems/[email protected]/gems/contacts-1.2.4/lib/contacts/gmail.rb:1:in `require' 
from /Users/seanfchan/.rvm/gems/[email protected]/gems/contacts-1.2.4/lib/contacts/gmail.rb:1:in `<top (required)>' 
from /Users/seanfchan/.rvm/gems/[email protected]/gems/contacts-1.2.4/lib/contacts.rb:6:in `require' 
from /Users/seanfchan/.rvm/gems/[email protected]/gems/contacts-1.2.4/lib/contacts.rb:6:in `<top (required)>' 
from /Users/seanfchan/.rvm/gems/[email protected]/gems/bundler-1.0.3/lib/bundler/runtime.rb:64:in `require' 
from /Users/seanfchan/.rvm/gems/[email protected]/gems/bundler-1.0.3/lib/bundler/runtime.rb:64:in `block (2 levels) in require' 
from /Users/seanfchan/.rvm/gems/[email protected]/gems/bundler-1.0.3/lib/bundler/runtime.rb:62:in `each' 
from /Users/seanfchan/.rvm/gems/[email protected]/gems/bundler-1.0.3/lib/bundler/runtime.rb:62:in `block in require' 
from /Users/seanfchan/.rvm/gems/[email protected]/gems/bundler-1.0.3/lib/bundler/runtime.rb:51:in `each' 
from /Users/seanfchan/.rvm/gems/[email protected]/gems/bundler-1.0.3/lib/bundler/runtime.rb:51:in `require' 
from /Users/seanfchan/.rvm/gems/[email protected]/gems/bundler-1.0.3/lib/bundler.rb:112:in `require' 
from /Users/seanfchan/RubyPractice/gettingContancts/config/application.rb:7:in `<top (required)>' 
from /Users/seanfchan/.rvm/gems/[email protected]/gems/railties-3.0.1/lib/rails/commands.rb:28:in `require' 
from /Users/seanfchan/.rvm/gems/[email protected]/gems/railties-3.0.1/lib/rails/commands.rb:28:in `block in <top (required)>' 
from /Users/seanfchan/.rvm/gems/[email protected]/gems/railties-3.0.1/lib/rails/commands.rb:27:in `tap' 
from /Users/seanfchan/.rvm/gems/[email protected]/gems/railties-3.0.1/lib/rails/commands.rb:27:in `<top (required)>' 
from script/rails:6:in `require' 
from script/rails:6:in `<main>' 

系统:MAC OSX雪豹
红宝石:RVM 1.9.2
的Rails:3.0.1
宝石:1.3.7
试图用 '接触' 宝石

谢谢,
Sean Chan

回答

17

听起来像你使用的库没有为Ruby 1.9更新。

Ruby> = 1.9没有jcode,它是一个处理日语(EUC/SJIS)字符串的模块,因为它本身支持unicode。

您可能希望看到的库的更新版本可用,否则,你可以看看源并找到它需要jcode,并与

require 'jcode' if RUBY_VERSION < '1.9' 
+0

感谢马克是没有的伎俩 – Sarindipity 2010-11-08 02:44:28

+0

我是新来的红宝石,并得到了同样的错误。你能告诉我确切的文件在哪里把这个代码? – Bongs 2011-08-18 04:55:05

+0

@Bongs:错误信息告诉你到底是什么文件和行。 – 2011-12-30 15:03:33

5

我们应该检查的lib更换在gdata gem文件下显示的文件夹。

加入这一行:

require 'jcode' if RUBY_VERSION < '1.9' 

lib/gdata.rb文件。

2

其他的解决方案,把这个在您的Gemfile:

gem 'gdata_19', '1.1.5' 
gem 'contacts', :git => '[email protected]:eofferma/contacts.git' 
+0

我只需切换到:gem'gdata_19','1.1.5' – whizcreed 2014-12-22 21:04:21