【问题标题】:heroku push of Rails 3.2 app suddenly fails with "Could not detect rake tasks" (no other errors)Rails 3.2 应用程序的 heroku 推送突然失败,并显示“无法检测到 rake 任务”(没有其他错误)
【发布时间】:2020-09-21 12:11:16
【问题描述】:

我在配置中更改了 nothing(没有新的 gem 或版本更改);只有一行代码,但我现在无法推送到heroku。 heroku 一定发生了一些变化?

它是 Rails 3.2.22.5;红宝石 2.3.1。 (是的,我正在升级到 Rails 5,但这是一项艰巨的工作,同时我还需要维护现有的生产系统。)

RAILS_ENV=生产包 exec rake -P 工作正常。我不认为这真的是一个rake问题。我最好的猜测是 heroku 发生了一些变化,以至于不再支持我拥有的某些版本,但我不知道是什么。而且我没有收到任何信息性错误消息。

不知所措...我已经在 Google 上进行了广泛的搜索,但大多数帖子都是 4 年以上的。我尝试在本地预编译并仅签入清单文件。我尝试升级 rake(从 13.0.0 到 13.0.1),但由于没有任何效果,所以我把所有东西都放回去了。

remote:        Bundle complete! 54 Gemfile dependencies, 118 gems now installed.
remote:        Gems in the groups development and test were not installed.
remote:        Bundled gems are installed into `./vendor/bundle`
remote:        Bundle completed (0.51s)
remote:        Cleaning up the bundler cache.
remote: -----> Writing config/database.yml to read from DATABASE_URL
remote: -----> Installing node-v12.16.2-linux-x64
remote: -----> Detecting rake tasks
remote: 
remote:  !
remote:  !     Could not detect rake tasks
remote:  !     ensure you can run `$ bundle exec rake -P` against your app
remote:  !     and using the production group of your Gemfile.
remote:  !     bash: /tmp/build_785c3bf77f08cff81f442938e3386876/bin/rake: /app/vendor/ruby-2.3.1/bin/ruby: bad interpreter: No such file or directory
remote:  !
remote: /tmp/buildpackvv7B3/lib/language_pack/helpers/rake_runner.rb:106:in `load_rake_tasks!': Could not detect rake tasks (LanguagePack::Helpers::RakeRunner::CannotLoadRakefileError)

【问题讨论】:

  • 我同意,我也不认为这是一个 rake 问题。当您运行RAILS_ENV=production bundle exec rake -P 时,是在您的heroku dyno 上还是在本地?如果没有,我会尝试在测功机上运行该命令。如果在那里成功,请键入which ruby 以查看安装 ruby​​ 的路径。我猜它不应该指向每个/app/vendor/ruby-2.3.1/bin/ruby: bad interpreter 的供应商目录。如果它没有指向那条路径,那么某些东西正指向那条路径。
  • 感谢您的回复!我在两个地方都这样做了,而且效果很好。事实证明,我们认为它不是 rake 是正确的——这是一个 buildpack 问题。我正在用解决方案在下面回答我自己的问题。

标签: ruby-on-rails git heroku ruby-on-rails-3.2 rake


【解决方案1】:

我询问了 heroku 支持,他们发现了问题。正如预期的那样,与 rake 或我的项目本身无关(因为我没有更改任何内容)。

这与构建包有关。我需要一个 PDF 生成器,所以我设置了一个“多构建包”(几年前完成),显然以不再受支持的方式。我相信最直接的原因是指向“主”构建包,而不是稳定版本。所以有人在 heroku 上检查了一些东西,它破坏了我的项目 :) 它可能只会影响几年前在旧雪松堆栈上设置它的人,就像我一样。

我跑了:

heroku buildpacks:remove https://github.com/heroku/heroku-buildpack-multi.git
heroku buildpacks:add heroku/ruby
heroku buildpacks:add https://github.com/dscout/wkhtmltopdf-buildpack.git

并且能够再次部署!

【讨论】:

    猜你喜欢
    • 2021-04-14
    • 2016-07-23
    • 2021-05-06
    • 2012-03-07
    • 1970-01-01
    • 1970-01-01
    • 2012-04-18
    相关资源
    最近更新 更多