Heroku: No Rakefile found (but works locally)
Asked Answered
E

3

13

I cloned one of my own apps using Rails 3.1.3, created an app on Heroku on stack cedar, pushed the to Heroku, and then tried to run

heroku run rake db:migrate and got this error message

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>

I am in the root of the app when I run rake db:migrate. The app works on localhost.

Any ideas what I might be doing wrong?

The only thing I note that seems odd is that, in the error message, it's referring to ruby/1.9.1/

However, I created the app using rvm with ruby 1.9.2 and when I do ruby -v

ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]

My Gemfile

source 'http://rubygems.org'

gem 'rails', '3.1.3'

# Bundle edge Rails instead:
# gem 'rails',     :git => 'git://github.com/rails/rails.git'

group :development, :test do
  gem 'sqlite3'
end
group :production do
  gem 'pg'
end

group :production do
  gem 'thin'
end

gem "heroku"

gem 'omniauth-facebook'
gem 'omniauth'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.1.5'
  gem 'coffee-rails', '~> 3.1.1'
  gem 'uglifier', '>= 1.0.3'
end

gem "rmagick"
gem "carrierwave"
gem 'fog'
gem 'simple_form'

gem 'devise'

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

group :test do
  # Pretty printed test output
  gem 'turn', '0.8.2', :require => false
end

my gitignore file

# See http://help.github.com/ignore-files/ for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
#   git config --global core.excludesfile ~/.gitignore_global

# Ignore bundler config
/.bundle

# Ignore the default SQLite database.
/db/*.sqlite3

# Ignore all logfiles and tempfiles.
/log/*.log
/tmp
Electrodeposit answered 31/3, 2012 at 19:5 Comment(10)
It's normal that the dir is named 1.9.1. Any chance that you Rakefile is not checked into your repository? Maybe excluded manually?Tetraploid
I posted a copy of my gitignore file in the OP. and I can open the rake file from my app directory. However, I have no idea how to check if the rake file was pushed to heroku. do u know?Electrodeposit
bash into the dyno and look: heroku run bash cd /app/Accroach
Rakefile is in same dir as Procfile?Remount
@NeilMiddleton okay I got bash running it just shows $$. Don't know how to look from here. Any tips?Electrodeposit
@JoshuaCheek I have never created a procfile with rails apps running on heroku.Electrodeposit
Have you pushed your code to Heroku? (git push heroku master)Remount
Bash is just a shell (the same thing you are win when you type cd whatever and rake db:migrate. You can use it to look around on the heroku machine so for example, ls -l should show you things like "app", "config", "Rakefile", etc.)Remount
@JoshuaCheek Yes, I did git push heroku NameOfApp (I assume it doesn't matter that it's not called Master) I did ls -l and it said 0. I did 'pwd' and it showed /appElectrodeposit
Heroku expects your code to be on the master branch. If locally it is on a different branch, you can push that branch to Heroku's master with git push heroku NameOfApp:masterRemount
A
37

You have to push to the master branch. From looking at the comments above it looks like you are not doing this.

Therefore, assuming you're developing your application in the master branch, you can deploy with a simple:

git push heroku master

If you're not developing on master deploy with:

git push heroku your_branch_name:master

replacing your_branch_name with the name of the branch you're using.

Accroach answered 1/4, 2012 at 21:18 Comment(0)
E
0

So i had my staging branch already clone and ready for deployment

I added a remote for heroku app heroku git:remote -a heroku-webapp-name-here

Then i was trying to do something like this: (and wasnt working) git push heroku staging

Finally running this worked liked a charm: git push heroku staging:master

The problem is that if you look in the heroku dashboard you will see that the heroku app is not ruby

Eroticism answered 18/10, 2018 at 3:7 Comment(0)
P
0

Actually your master branch or whicher branch you're pushing did not get pushed to heroku, that's why it says no Rakefile.

Most likely... I think when you created your heroku app with heroku CLI in your terminal and you probably did not indicate which stack of heroku you want to use. See they have several stacks. I think cedar-14, heroku-16, heroku-18 and heroku-20.

So depending on your ruby version. You should find out if the ruby version of your rails app is found in the above heroku stacks. You will need change the stack by doing this in your terminal.

Say for example your ruby version is present in cedar-14. You don't need to delete your app and recreate a new one. You can just change the stack from the heroku cli like this.

heroku stack:set cedar-14

for future apps better specify the heroku stack. For example, like this:

heroku create --stack cedar-14

Then rename your app

heroku rename myapp

Again if Heroku can't find your rakefile is because nothing was pushed to heroku.

Plasticizer answered 29/3, 2021 at 0:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.