【发布时间】:2020-02-07 06:35:16
【问题描述】:
Rails 版本:Rails 6.0.2.1
Ruby 版本:ruby 2.6.3p62(2019-04-16 修订版 67580)[x86_64-linux]
当我尝试在 Heroku 中使用 gem rails-latex 生成 PDF 时,我收到以下错误:ActionView::Template::Error rails-latex failed(下面的完整错误消息)。
本地不会出现此错误。
我尝试了什么
已经有一个stackoverflow-question有同样的问题:Debugging rails-latex gem on Heroku | ActionView::Template::Error rails-latex failed
@blackbrokkoli 写道:
如果你有类似的问题,我建议删除所有 tex 依赖关系,获取 MWE,然后慢慢将它们添加回来以识别 恶人。
但我不知道他所说的“MWE”是什么意思,我怀疑自己能否“识别恶人”。
有一个线程叫做“Deploying on Heroku”,提示需要安装一个buildpack。
我尝试按照“Multipacks”选项的说明进行操作。
命令cat .buildpacks 返回
cat: .buildpacks: No such file or directory
heroku config:add BUILDPACK_URL=git://github.com/ddollar/heroku-buildpack-multi.git 命令返回:
Setting BUILDPACK_URL and restarting
BUILDPACK_URL: git://github.com/ddollar/heroku-buildpack-multi.git
但在那之后,我不知道如何继续。
我试图弄清楚如何使用 heroku buildpacks:add 命令使用 Heroku 来 add buildpacks。但我想不通,如何使用此命令添加第三方 buildpack。
有人对如何修复此错误有任何建议吗?
heroku logs 中的错误消息
2020-02-07T05:50:55.909360+00:00 app[web.1]: I, [2020-02-07T05:50:55.909264 #4] INFO -- : [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] Started GET "/articles/2.pdf" for 87.245.109.31 at 2020-
02-07 05:50:55 +0000
2020-02-07T05:50:55.910207+00:00 app[web.1]: I, [2020-02-07T05:50:55.910130 #4] INFO -- : [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] Processing by ArticlesController#show as PDF
2020-02-07T05:50:55.910257+00:00 app[web.1]: I, [2020-02-07T05:50:55.910202 #4] INFO -- : [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] Parameters: {"id"=>"2"}
2020-02-07T05:50:55.913042+00:00 app[web.1]: D, [2020-02-07T05:50:55.912964 #4] DEBUG -- : [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] Article Load (1.1ms) SELECT "articles".* FROM "articl
es" WHERE "articles"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]]
2020-02-07T05:50:55.914866+00:00 app[web.1]: I, [2020-02-07T05:50:55.914789 #4] INFO -- : [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] Rendering articles/show.pdf.erb within layouts/applica
tion
2020-02-07T05:50:55.915357+00:00 app[web.1]: I, [2020-02-07T05:50:55.915290 #4] INFO -- : [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] Rendered articles/show.pdf.erb within layouts/applicat
ion (Duration: 0.4ms | Allocations: 101)
2020-02-07T05:50:55.916214+00:00 app[web.1]: I, [2020-02-07T05:50:55.916141 #4] INFO -- : [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] Running 'pdflatex -halt-on-error -shell-escape -interact
ion=batchmode input' in /app/tmp/rails-latex/4-521112460259582216 1 times...
2020-02-07T05:50:55.923855+00:00 app[web.1]: I, [2020-02-07T05:50:55.923739 #4] INFO -- : [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] Running 'bibtex input' in /app/tmp/rails-latex/4-5211124
60259582216 1 times...
2020-02-07T05:50:55.929983+00:00 app[web.1]: I, [2020-02-07T05:50:55.929846 #4] INFO -- : [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] Running 'pdflatex -halt-on-error -shell-escape -interact
ion=batchmode input' in /app/tmp/rails-latex/4-521112460259582216 2 times...
2020-02-07T05:50:55.936216+00:00 app[web.1]: I, [2020-02-07T05:50:55.936104 #4] INFO -- : [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] Completed 500 Internal Server Error in 26ms (ActiveRecor
d: 1.1ms | Allocations: 1610)
2020-02-07T05:50:55.937843+00:00 app[web.1]: F, [2020-02-07T05:50:55.937756 #4] FATAL -- : [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3]
2020-02-07T05:50:55.937845+00:00 app[web.1]: [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] ActionView::Template::Error (rails-latex failed: See /app/tmp/rails-latex/4-521112460259582216/input.l
og for details):
2020-02-07T05:50:55.937845+00:00 app[web.1]: [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] 15:
2020-02-07T05:50:55.937846+00:00 app[web.1]: [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] 16: \end{document}
2020-02-07T05:50:55.937846+00:00 app[web.1]: [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3]
2020-02-07T05:50:55.937847+00:00 app[web.1]: [1c4e2355-293c-4cb1-b591-b97e4ba4ecf3] app/views/layouts/application.pdf.erbtex:18
@Syed Asim Hashmi 建议使用此命令安装第三方 buildpack:
heroku buildpacks:add git://github.com/Thermondo/heroku-buildpack-tex.git#VERSION_NUMBER
这是我得到的:
heroku buildpacks:add git://github.com/Thermondo/heroku-buildpack-te
x.git#VERSION_NUMBER
› Error: Could not find the buildpack:
› git://github.com/Thermondo/heroku-buildpack-tex.git#VERSION_NUMB
› ER. To specify a buildpack, please format it like the following:
› namespace/name (e.g. heroku/ruby). Also names can only contain
› letters, numbers, '_', and '-'.
我尝试通过 heroku 网站上的设置添加 buildpack:
我用heroku restart 重新启动了heroku
但我收到相同的错误消息。
【问题讨论】:
标签: ruby-on-rails heroku