我已在命令行中切换到使用heroku toolbelt而没有问题。但是,我的rake任务现在失败了:
=> Running "heroku run rake --trace db:migrate --app MYAPPNAME"
/Users/USERNAME/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/rubygems_integration.rb:143:in `block in replace_gem': heroku is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
from /Users/USERNAME/.rvm/gems/ruby-1.9.2-p290/bin/heroku:18:in `<main>'
rake aborted!
ERROR running "heroku run rake --trace db:migrate --app MYAPPNAME"
/Users/USERNAME/Code/luxr/lib/shell.rb:35:in `execute'
/Users/USERNAME/Code/luxr/lib/tasks/deploy_tasks.rake:22:in `block (2 levels) in <top (required)>'
Tasks: TOP => deploy:production
(See full trace by running task with --trace)
相同的命令heroku run rake --trace db:migrate --app MYAPPNAME
可以直接在命令行中输入。
想法?
更新:我安装了heroku工具带,但我注意到它是在ruby 1.9.3上,而我的应用程序是1.9.2p290,是否会导致问题?
$ heroku version
heroku-toolbelt/2.34.0 (x86_64-darwin10.8.0) ruby/1.9.3
$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.2.0]
答案 0 :(得分:1)
使用Bundler.with_clean_env
运行heroku命令对我有用。如果要运行的rake任务名为cache_flush
,请使用Bundler.with_clean_env
task :cache_flush do
Bundler.with_clean_env { p `heroku --help` }
end