问题描述
我是 Ruby on Rails 的新手.在摆弄了一个星期之后,我决定放弃它,买了一本书.全部重新安装.现在,当我认为我已修复它时,我收到一条错误消息:
I am new to Ruby on Rails. After fiddling around with it for a week I decided to give it ago, bought a book. Reinstalled it all. And now when I thought I fixed it, I get an error saying:
Routing Error
No route matches "/index"
所以我做到了
rake routes
这导致了下面的错误列表.
And that resulted in the error list below.
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/version.rb:4:
warning: already initialized constant MAJOR
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/version.rb:5:
warning: already initialized constant MINOR
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/version.rb:6:
warning: already initialized constant BUILD
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/version.rb:3:
warning: already initialized constant NUMBERS
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/version.rb:9:
warning: already initialized constant VERSION
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake.rb:26:
warning: already initialized constant RAKEVERSION
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/early_time.rb:17:
warning: already initialized constant EARLY
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/alt_system.rb:32:
warning: already initialized constant WINDOWS
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:28:
warning: already initialized constant DEFAULT_RAKEFILES WARNING:
Possible conflict with Rake extension: String#ext already exists
WARNING: Possible conflict with Rake extension: String#pathmap already
exists
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task_arguments.rb:73:
warning: already initialized constant EMPTY_TASK_ARGS
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/invocation_chain.rb:49:
warning: already initialized constant EMPTY
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/file_utils.rb:10:
warning: already initialized constant RUBY
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/file_utils.rb:84:
warning: already initialized constant LN_SUPPORTED
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/dsl_definition.rb:143:
warning: already initialized constant Commands
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/file_list.rb:44:
warning: already initialized constant ARRAY_METHODS
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/file_list.rb:47:
warning: already initialized constant MUST_DEFINE
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/file_list.rb:51:
warning: already initialized constant MUST_NOT_DEFINE
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/file_list.rb:55:
warning: already initialized constant SPECIAL_RETURN
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/file_list.rb:61:
warning: already initialized constant DELEGATING_METHODS
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/file_list.rb:364:
warning: already initialized constant DEFAULT_IGNORE_PATTERNS
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/file_list.rb:370:
warning: already initialized constant DEFAULT_IGNORE_PROCS
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake.rb:64:
warning: already initialized constant FileList
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake.rb:65:
warning: already initialized constant RakeFileUtils rake aborted!
stack level too deep
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/rake_module.rb:25
推荐答案
尝试安装旧版本的 rake.
Try to install an older version of rake.
gem install rake -v=0.8.7
使用 rake 时可能会收到警告消息.
You might get a warning message when using rake.
警告:对 Rake DSL 方法的全局访问已被弃用.请包括... Rake::DSL 到使用 Rake DSL 方法的类和模块中.
WARNING: Global access to Rake DSL methods is deprecated. Please include ... Rake::DSL into classes and modules which use the Rake DSL methods.
您可以在调用应用程序 load_tasks 之前将include Rake::DSL"添加到 Rakefile.
You can just add "include Rake::DSL" to the Rakefile before the applications load_tasks were called.
我找到了一个帖子来解决这个问题.不推荐使用 Rake DSL 方法的全局访问
I found a post to fix that issue.Global access to Rake DSL methods is deprecated
这篇关于什么是路由错误和 rake 路由错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!