2010-11-08 121 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