Rails 求助 rails4-rc2 问题 undefined method `fetch' for "QLite version 3.x":String (NoMethodError)

heimirror · 2013年06月16日 · 最后由 heimirror 回复于 2013年06月16日 · 5144 次阅读

昨天安装了 rails4-rc2,结果项目在服务器上无法启动了,详细错误如下,求大家给看看是怎么回事

undefined method fetch' for "QLite version 3.x":String (NoMethodError) /usr/local/rvm/gems/ruby-2.0.0-p0/gems/activerecord-4.0.0.rc2/lib/active_record/connection_adapters/connection_specification.rb:40:inresolve_string_connection' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/activerecord-4.0.0.rc2/lib/active_record/connection_adapters/connection_specification.rb:30:in spec' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/activerecord-4.0.0.rc2/lib/active_record/connection_handling.rb:39:inestablish_connection' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/activerecord-4.0.0.rc2/lib/active_record/railtie.rb:170:in block (2 levels) in <class:Railtie>' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.rc2/lib/active_support/lazy_load_hooks.rb:38:ininstance_eval' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.rc2/lib/active_support/lazy_load_hooks.rb:38:in execute_hook' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.rc2/lib/active_support/lazy_load_hooks.rb:45:inblock in run_load_hooks' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.rc2/lib/active_support/lazy_load_hooks.rb:44:in each' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.rc2/lib/active_support/lazy_load_hooks.rb:44:inrun_load_hooks' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/activerecord-4.0.0.rc2/lib/active_record/base.rb:322:in <module:ActiveRecord>' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/activerecord-4.0.0.rc2/lib/active_record/base.rb:22:in' /var/rails_apps/core_oa/app/models/user.rb:1:in <top (required)>' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:228:inrequire' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:228:in block in require' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:213:inload_dependency' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:228:in require' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:329:inrequire_or_load' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:288:in depend_on' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:206:inrequire_dependency' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc2/lib/rails/engine.rb:465:in block (2 levels) in eager_load!' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc2/lib/rails/engine.rb:464:ineach' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc2/lib/rails/engine.rb:464:in block in eager_load!' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc2/lib/rails/engine.rb:462:ineach' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc2/lib/rails/engine.rb:462:in eager_load!' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc2/lib/rails/engine.rb:347:ineager_load!' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc2/lib/rails/application/finisher.rb:56:in each' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc2/lib/rails/application/finisher.rb:56:inblock in module:Finisher' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc2/lib/rails/initializable.rb:30:in instance_exec' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc2/lib/rails/initializable.rb:30:inrun' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc2/lib/rails/initializable.rb:55:in block in run_initializers' /usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/tsort.rb:150:inblock in tsort_each' /usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/tsort.rb:183:in block (2 levels) in each_strongly_connected_component' /usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/tsort.rb:219:ineach_strongly_connected_component_from' /usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/tsort.rb:182:in block in each_strongly_connected_component' /usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/tsort.rb:180:ineach' /usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/tsort.rb:180:in each_strongly_connected_component' /usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/tsort.rb:148:intsort_each' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc2/lib/rails/initializable.rb:54:in run_initializers' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc2/lib/rails/application.rb:215:ininitialize!' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc2/lib/rails/railtie/configurable.rb:30:in method_missing' /var/rails_apps/core_oa/config/environment.rb:5:in' config.ru:3:in require' config.ru:3:inblock in

' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/builder.rb:55:in instance_eval' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/builder.rb:55:ininitialize' config.ru:1:in new' config.ru:1:in' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/passenger-4.0.5/helper-scripts/rack-preloader.rb:82:in eval' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/passenger-4.0.5/helper-scripts/rack-preloader.rb:82:inpreload_app' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/passenger-4.0.5/helper-scripts/rack-preloader.rb:127:in <module:App>' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/passenger-4.0.5/helper-scripts/rack-preloader.rb:6:inmodule:PhusionPassenger' /usr/local/rvm/gems/ruby-2.0.0-p0/gems/passenger-4.0.5/helper-scripts/rack-preloader.rb:5:in `'

查看 Passenger 状态,是没有启动 ERROR: Phusion Passenger doesn't seem to be running.

Trace Log 出错堆栈是越上面越接近出错位置。

undefined method fetch' for "QLite version 3.x":String (NoMethodError)
/usr/local/rvm/gems/ruby-2.0.0-p0/gems/activerecord-4.0.0.rc2/lib/active_record/connection_adapters/connection_specification.rb:40:inresolve_string_connection'

检查你的 connection string,是否 SQLite 少了一个 S?

#2 楼 @ericguo 谢谢,从本地复制粘贴的时候应该是 # SQLite version 3.x 丢掉 #S 我汗啊,低级错误。。。。。 再次谢谢

需要 登录 后方可回复, 如果你还没有账号请 注册新账号