Heroku运行rake是什么不知道如何构建任务'默认'意味着什么?

时间:2013-08-25 05:39:59

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

当我去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>'

这个错误是什么意思?

2 个答案:

答案 0 :(得分:2)

Rake是实用程序的名称 - 请参阅更多信息here - 因此您无法只调用该实用程序。这就像打开你的网络浏览器,并期望它自己做一些事情,没有任何说明。

尝试运行其中一个:

heroku run rake db:create

heroku run rake db:schema:load

git push heroku master&lt; 运行此命令之前,请确保已将你想要显示在heroku上的任何内容推送到github

答案 1 :(得分:0)

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

rake [taskname]

如果你没有指定taskname,rake将尝试执行一个名为default的特殊任务。您可以指定名为default的任务,也可以使用默认值链接任务:

task :default => "taskname"

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

我猜您正在尝试将数据库部署到heroku。对于那只是运行:

heroku run rake db:migrate