Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
846 views
in Technique[技术] by (71.8m points)

ruby on rails - Rake aborted! Uninitialized constant Rake::DSL on Heroku

When trying to rake db:migrate on Heroku. I'm getting the following error.

rake aborted!
uninitialized constant Rake::DSL

From what I've gathered this seems to be a bug with Rake 0.9.2. If I do "gem list" locally only Rake (0.8.7) appears to be installed.

I've tried adding "gem 'rake', '0.8.7'" to my gem file and running bundle install but then I get the following error.

You have requested:
rake = 0.8.7

The bundle currently has rake locked at 0.9.2.
Try running `bundle update rake`

If I do run bundle update rake, it reverts back to 0.9.2, and I'm back where I started.

Am I missing something obvious here?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You should run commands with bundle exec to ensure your getting the proper dependencies. So run:

bundle exec rake db:migrate

For a more detailed post see Yehuda Katz blog post http://yehudakatz.com/2011/05/30/gem-versioning-and-bundler-doing-it-right/

If you still continue to have problems there appears to be several other people with the same issue How to fix the uninitialized constant Rake::DSL problem on Heroku? which they resolved by adding the following to their Rakefile:

require 'rake/dsl_definition'
require 'rake'

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...