【问题标题】:What does Heroku run rake Don't know how to build task 'default' mean? [closed]Heroku run rake 是什么意思? [关闭]
【发布时间】:2013-08-27 21:05:08
【问题描述】:

当我去heroku run rake 时,Rake 被中止,下一行说,Don't know how to build task 'default'

heroku run rake --trace得到了

Running `rake --trace` attached to terminal... up, run.3479
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these     plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
rake aborted!
Don't know how to build task 'default'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task_manager.rb:49:in `[]'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:148:in `invoke_task'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in `block in top_level'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:115:in `run_with_threads'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:100:in `top_level'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:78:in `block in run'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/bin/rake:23:in `load'
/app/vendor/bundle/ruby/2.0.0/bin/rake:23:in `<main>'

这个错误是什么意思?

【问题讨论】:

  • 但是你想做什么?
  • 我进入了 heroku random.heroku.com/refinery 中的一个子目录,并且能够创建一个用户帐户。但是根路径显示页面不存在错误。似乎也缺少资产,因为仪表板中的某些 CSS 已关闭。阅读@dax 链接的Rake 文档,并尝试了以下操作:heroku run rake routes heroku run rake assets:precompile heroku run rake db:migrate 但什么都没找到

标签: ruby-on-rails ruby heroku rake dbmigrate


【解决方案1】:

Rake 是实用程序的名称 - 查看更多信息 here - 所以你不能只调用实用程序。这就像打开您的网络浏览器并期望它自己为您做某事而无需任何指示。

尝试运行以下之一:

heroku run rake db:create

heroku run rake db:schema:load

git push heroku master 已将要在heroku 上显示的任何内容推送到你的github。

【讨论】:

  • 或者heroku run rake db:migrate 如果 OP 在他的数据库中有数据。
  • 运行了所有建议的命令,但应用仍然显示您要查找的页面不存在
  • 实际上,这些命令可能无法解决您的问题 - 它们只是指出 rake 是什么以及您的问题来自哪里。您应该阅读我在答案中链接到的文档
【解决方案2】:

运行rake任务的基本语法是:

rake [taskname]

如果你没有指定任务名,rake 会尝试执行一个名为 default 的特殊任务。您可以指定名为 default 的任务或将任务与 default 链接,如下所示:

task :default => "taskname"

由于您的 rake 文件中没有指定默认任务,因此您会收到此错误。

我猜您正在尝试将您的数据库部署到 heroku。就这样运行:

heroku run rake db:migrate

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-12-29
    • 2014-09-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-29
    • 2014-04-03
    • 2013-05-16
    相关资源
    最近更新 更多