当我运行heroku run rake db:migrate
时,收到以下错误:
$ heroku run rake db:migrate
Running `rake db:migrate` attached to terminal... up, run.8507
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
/usr/local/lib/ruby/1.9.1/rake.rb:2367:in `raw_load_rakefile'
/usr/local/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
/usr/local/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
/usr/local/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
/usr/local/lib/ruby/1.9.1/rake.rb:1991:in `run'
/usr/local/bin/rake:31:in `<main>'
其他用户发布了相同的错误,但在他们的情况下,他们实际上没有Rakefile,一旦他们创建了一个Rakefile,它们就可以使用它们,或者它们位于错误的目录中。我的应用程序确实有一个Rakefile,在正确的目录中,并包含所有正确的文本,我在我的应用程序的根目录。
这是我的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__)
Rails.application.load_tasks
这就是&#34; heroku运行cat Rakefile&#34;作用:
$ heroku run cat Rakefile
Running `cat Rakefile` attached to terminal... up, run.9132
cat: Rakefile: No such file or directory
答案 0 :(得分:2)
heroku logs
扫描您可以谷歌的任何错误和/或获取有关出错的提示。
git grep "whatever you want to search for"
git grep rakefile
rake db:reset db:migrate all
rake db:drop db:create db:migrate
heroku pg:reset DATABASE
heroku run rake db:migrate
heroku run rake db:seed