无法启动Rails服务器

时间:2011-06-27 05:14:07

标签: ruby-on-rails ruby ruby-on-rails-3 rake server-error

我正在研究Ubuntu 10.04 LTS,Lucid Lynx,已经安装了Ruby on Rails 3。我无法启动Rails服务器。我收到以下错误。

mah@mah-laptop:~/Desktop/projects/ver$ rails s
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.8/lib/rails/commands.rb:29:in `block in <top (required)>': undefined method `root' for nil:NilClass (NoMethodError)
from /home/mah/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.8/lib/rails/commands.rb:27:in `tap'
from /home/mah/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.8/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

我正在使用Rails 3.0.8和rake版本0.8.7

我尝试了bundle exec,但遇到了同样的错误。

感谢您提前提供任何帮助

更新

以下是bundle exec rake db:migrate --trace

后的内容
mah@mah-laptop:~/Desktop/projects/ver$ bundle exec rake db:migrate --trace
rake aborted!
uninitialized constant Ver
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing_from_s3_library'
/home/mah/Desktop/projects/ver/Rakefile:7:in `<top (required)>'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/application.rb:495:in `raw_load_rakefile'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/application.rb:78:in `block in load_rakefile'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/application.rb:77:in `load_rakefile'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/application.rb:61:in `block in run'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/home/mah/.rvm/gems/ruby-1.9.2-p0/bin/rake:19:in `load'
/home/mah/.rvm/gems/ruby-1.9.2-p0/bin/rake:19:in `<main>'

1 个答案:

答案 0 :(得分:1)

此错误表示Rails.application未初始化。我实际上并不知道,I cheated

然后提出问题:你是如何设置这个应用程序的?

也许这个应用程序不包含config/application.rb文件,该文件定义了一个继承自Rails::Application的类,因此导致了这个问题。在我的应用程序中,我可以使用this one作为示例。