gpt4 book ai didi

ruby-on-rails - 运行 rake 命令时出错

转载 作者:太空宇宙 更新时间:2023-11-03 18:25:27 24 4
gpt4 key购买 nike

在使用 Rails 2.0.2 和 ruby​​ 1.8.6 处理旧应用程序时,出现以下问题...

当我尝试执行任何 rake(v 0.8.3) 命令时 { 例如。 rake 路线}。

rake aborted!
Don't know how to build task 'routes'
~/.rvm/gems/ruby-1.8.6-p420@rails202/gems/rake-0.8.3/lib/rake.rb:1706:in `[]'
~/.rvm/gems/ruby-1.8.6-p420@rails202/gems/rake-0.8.3/lib/rake.rb:2018:in `invoke_task'
~/.rvm/gems/ruby-1.8.6-p420@rails202/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level'
~/.rvm/gems/ruby-1.8.6-p420@rails202/gems/rake-0.8.3/lib/rake.rb:1997:in `each'
~/.rvm/gems/ruby-1.8.6-p420@rails202/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level'
~/.rvm/gems/ruby-1.8.6-p420@rails202/gems/rake-0.8.3/lib/rake.rb:2036:in `standard_exception_handling'
~/.rvm/gems/ruby-1.8.6-p420@rails202/gems/rake-0.8.3/lib/rake.rb:1991:in `top_level'
~/.rvm/gems/ruby-1.8.6-p420@rails202/gems/rake-0.8.3/lib/rake.rb:1970:in `run'
~/.rvm/gems/ruby-1.8.6-p420@rails202/gems/rake-0.8.3/lib/rake.rb:2036:in `standard_excetion_handling'
~/.rvm/gems/ruby-1.8.6-p420@rails202/gems/rake-0.8.3/lib/rake.rb:1967:in `run'
~/.rvm/gems/ruby-1.8.6-p420@rails202/bin/rake:31

一开始没有rakefile,我加了一个,内容如下

# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)
require 'rake'

XXX::Application.load_tasks

最佳答案

我有一个 Rails 2.3.8 应用程序

Rakefile 看起来像这样:

# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require 'thread'
require(File.join(File.dirname(__FILE__), 'config', 'boot'))

require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'

require 'tasks/rails'

您添加的 rake 文件与 rails 3 兼容,我认为它不适用于早期版本。

编辑:您必须已经设置了 rails 2.0.2,我建议创建一个新的 rails 2.0.2 应用程序并确定缺少的链接。

关于ruby-on-rails - 运行 rake 命令时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11900400/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com