如何修复 Heroku 上未初始化的常量 Rake::DSL 问题? [英] How to fix the uninitialized constant Rake::DSL problem on Heroku?

查看:26
本文介绍了如何修复 Heroku 上未初始化的常量 Rake::DSL 问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到的错误类似于这些 问题,除了我的问题发生在 Heroku:

I am getting errors similar to the ones in these questions, except mine are occuring on Heroku:

2011-05-30T09:03:29+00:00 heroku[worker.1]: Starting process with command: `rake jobs:work`
2011-05-30T09:03:30+00:00 app[worker.1]: (in /app)
2011-05-30T09:03:30+00:00 heroku[worker.1]: State changed from starting to up
2011-05-30T09:03:33+00:00 app[worker.1]: rake aborted!
2011-05-30T09:03:33+00:00 app[worker.1]: uninitialized constant Rake::DSL
2011-05-30T09:03:33+00:00 app[worker.1]: /app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.0/lib/rake/tasklib.rb:8:in `<class:TaskLib>'

这些问题的答案似乎是指定 gem 'rake', '0.8.7' 因为 0.9 版本导致了这个问题.

The answer in those questions seems to be to specify gem 'rake', '0.8.7' because the 0.9 version causes the problem.

当我尝试将 gem 'rake', '0.8.7' 添加到我的 gemfile 并推送到 Heroku 时,我收到此错误:

When I try to add gem 'rake', '0.8.7' to my gemfile and push to Heroku I get this error:

Unresolved dependencies detected; Installing...
You have modified your Gemfile in development but did not check
the resulting snapshot (Gemfile.lock) into version control

You have added to the Gemfile:
* rake (= 0.8.7)
FAILED: http://devcenter.heroku.com/articles/bundler
! Heroku push rejected, failed to install gems via Bundler
error: hooks/pre-receive exited with error code 1
To git@heroku.com:my_app.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:my_app.git'

我的 gemfile 在 Heroku 上通常可以正常工作.我该怎么办?

My gemfile normally works fine on Heroku. What should I do?

推荐答案

把它放在你的 Rakefile above require 'rake':

Put this in your Rakefile above require 'rake':

require 'rake/dsl_definition'

这篇关于如何修复 Heroku 上未初始化的常量 Rake::DSL 问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆