运行rails服务器时没有"jcode"gem

Sar*_*ity 11 ruby-on-rails

当我尝试运行'rails server'时,它给我一个错误,说它找不到'jcode',我认为jcode是一个默认的ruby lib.你们有什么线索关于什么事情发生?

/Users/seanfchan/.rvm/gems/ruby-1.9.2-p0@global/gems/gdata-1.1.1/lib/gdata.rb:21:in `require': no such file to load -- jcode (LoadError)
 from /Users/seanfchan/.rvm/gems/ruby-1.9.2-p0@global/gems/gdata-1.1.1/lib/gdata.rb:21:in `<top (required)>'
 from /Users/seanfchan/.rvm/gems/ruby-1.9.2-p0@global/gems/contacts-1.2.4/lib/contacts/gmail.rb:1:in `require'
 from /Users/seanfchan/.rvm/gems/ruby-1.9.2-p0@global/gems/contacts-1.2.4/lib/contacts/gmail.rb:1:in `<top (required)>'
 from /Users/seanfchan/.rvm/gems/ruby-1.9.2-p0@global/gems/contacts-1.2.4/lib/contacts.rb:6:in `require'
 from /Users/seanfchan/.rvm/gems/ruby-1.9.2-p0@global/gems/contacts-1.2.4/lib/contacts.rb:6:in `<top (required)>'
 from /Users/seanfchan/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.3/lib/bundler/runtime.rb:64:in `require'
 from /Users/seanfchan/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.3/lib/bundler/runtime.rb:64:in `block (2 levels) in require'
 from /Users/seanfchan/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.3/lib/bundler/runtime.rb:62:in `each'
 from /Users/seanfchan/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.3/lib/bundler/runtime.rb:62:in `block in require'
 from /Users/seanfchan/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.3/lib/bundler/runtime.rb:51:in `each'
 from /Users/seanfchan/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.3/lib/bundler/runtime.rb:51:in `require'
 from /Users/seanfchan/.rvm/gems/ruby-1.9.2-p0@global/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/ruby-1.9.2-p0@global/gems/railties-3.0.1/lib/rails/commands.rb:28:in `require'
 from /Users/seanfchan/.rvm/gems/ruby-1.9.2-p0@global/gems/railties-3.0.1/lib/rails/commands.rb:28:in `block in <top (required)>'
 from /Users/seanfchan/.rvm/gems/ruby-1.9.2-p0@global/gems/railties-3.0.1/lib/rails/commands.rb:27:in `tap'
 from /Users/seanfchan/.rvm/gems/ruby-1.9.2-p0@global/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>'
Run Code Online (Sandbox Code Playgroud)

系统:Mac OSx Snow Leopard
Ruby:RVM 1.9.2
Rails:3.0.1
Gem:1.3.7
试图使用'contacts'宝石

谢谢,
肖恩陈

Mar*_*mas 17

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

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

您可能希望看到更新版本的库可用,否则您可以查看源代码并找到它需要jcode的位置,并将其替换为

require 'jcode' if RUBY_VERSION < '1.9'
Run Code Online (Sandbox Code Playgroud)


小智 5

我们应该检查gdata gem文件下的lib文件夹.

添加此行:

require 'jcode' if RUBY_VERSION < '1.9'
Run Code Online (Sandbox Code Playgroud)

lib/gdata.rb文件中.