无法启动Rails服务器 [英] Not able to start Rails server
问题描述
我正在研究Ubuntu 10.04 LTS(Lucid Lynx),它已经在其上安装了Ruby on Rails 3.我无法启动Rails服务器.我收到以下错误.
I am working on Ubuntu 10.04 LTS, Lucid Lynx, have installed Ruby on Rails 3 on it. I am not able to start Rails server. I am getting the following error.
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
I am using Rails 3.0.8 and rake version 0.8.7
我尝试了bundle exec
,但遇到了相同的错误.
I tried bundle exec
but got same error.
非常感谢您提前提供帮助
Thanks for any help in advance
更新
这是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>'
推荐答案
此错误表示Rails.application
未初始化.我实际上并不知道,我
被骗.
This error means that Rails.application
isn't initialized. I didn't actually know that, I
cheated.
因此,这就引出了一个问题:您是如何设置此应用程序的?
So that then begs the question: how did you set up this application?
也许此应用程序不包含config/application.rb
文件,该文件定义了从Rails::Application
继承的类,因此导致了此问题.在这里的应用程序中,您可以这举个例子.
Perhaps this application doesn't contain a config/application.rb
file that defines a class that inherits from Rails::Application
and therefore is causing this problem. In my application here, I've got this one you could use as an example.
这篇关于无法启动Rails服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!