Heroku run rake db: migrate ... rake aborted! No rake files found

When I run heroku run rake db:migrate, I get the following error:

$ 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>'

Other users posted the same errors, but in their case they did not actually have a Rakefile, and they worked for them after they were created, or they were in the wrong directory. My application has a Rakefile, in the correct directory and with all the relevant text in it, and I'm in the root directory of the application.

This is what my Rakefile looks like:

    # 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

This is what the "heroku run cat rakefile" does:

    $ heroku run cat Rakefile
    Running `cat Rakefile` attached to terminal... up, run.9132
    cat: Rakefile: No such file or directory
+4
source share
1 answer

, Heroku, :

heroku logs

, Google, / , .

git, :

git grep "whatever you want to search for"

, , , rakefile :

git grep rakefile

reset

rake db:reset db:migrate all

db, , :

rake db:drop db:create db:migrate 

reset db

, SHARED_DATABASE_URL:

heroku pg:reset DATABASE

:

heroku run rake db:migrate

:

heroku run rake db:seed
+2

Source: https://habr.com/ru/post/1545321/


All Articles