本文介绍了Heroku:找不到Rakefile(但在本地工作)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Rails 3.1.3克隆了自己的应用程序之一,在堆栈雪松上的Heroku上创建了一个应用程序,将其推送到Heroku,然后尝试运行 heroku运行rake db:migrate 并得到这个错误信息

 没有Rakefile找到(寻找: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:在'run'中
/ usr / local / bin / rake:31:在< main>

当我运行 rake db:migrate时,我在应用程序的根目录下



任何想法我可能做错了什么?



我注意到的唯一的东西这似乎很奇怪,在错误消息中,它指的是 ruby​​ / 1.9.1 /



然而,我使用rvm和ruby 1.9.2创建了应用程序,当我做了 ruby​​ -v

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

我的Gemfile

 源'http://rubygems.org'

gem'rails','3.1.3'

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

组:开发,:test do
gem'sqlite3'
结束
组:生产do
gem'pg'
end

group:production do
gem'thin'
end

gemheroku

gem'omniauth-facebook'
gem'omniauth'

#Gems只用于资产而不需要
#默认为生产环境。
group:assets do
gem'sass-rails','〜> 3.1.5'
gem'咖啡栏','〜> 3.1.1'
gem'uglifier','> = 1.0.3'
结束

宝石rmagick
宝石carrierwave
gem'fog'
gem'simple_form'

gem'devise'

gem'jquery-rails'

#使用ActiveModel has_secure_password
#gem'bcrypt-ruby','〜> 3.0.0'

#使用独角兽作为web服务器
#gem'unicorn'

#使用Capistrano部署
#gem'capistrano'

#使用调试器
#gem'ruby-debug19',:require => 'ruby-debug'

group:test do
#漂亮的打印测试输出
gem'turn','0.8.2',:require => false
end

我的gitignore文件

 #有关忽略文件的更多信息,请参阅http://help.github.com/ignore-files/。 

#如果您发现自己忽略了文本编辑器
#或操作系统生成的临时文件,则可能需要添加全局忽略:
#git config - 全局core.excludesfile〜/ .gitignore_global

#忽略bundler config
/.bundle

#忽略默认的SQLite数据库。
/db/*.sqlite3

#忽略所有日志文件和临时文件。
/log/*.log
/ tmp


解决方案 div>

你必须推送到主分支。看看上面的注释,看起来你并没有这样做。



因此,假设你在master分支中开发你的应用程序,你可以用一个简单的:

  git push heroku master 

如果您没有使用以下方式开发主部署:

  git push heroku your_branch_name:master 

将your_branch_name替换为您正在使用的分支的名称。


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
解决方案

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.

这篇关于Heroku:找不到Rakefile(但在本地工作)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 08:10