Rails清单文件未找到(使用Capistrano进行部署)

12

我正在尝试使用Capistrano部署一个Rails应用,但是失败了,因为没有清单文件。

当我运行cap production deploy时,我得到的结果如下:

01 mkdir -p /home/deploy/list/releases/20171220202012/assets_manif…
✔ 01 influencerlist.io 0.048s
  WARN  Rails assets manifest file not found.
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host influencerlist.io: Rails assets manifest file not found.


Caused by:
Capistrano::FileNotFound: Rails assets manifest file not found.

Tasks: TOP => deploy:assets:backup_manifest
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing on host influencerlist.io: Rails assets manifest file not found.
任何想法如何解决这个问题?我已经尝试找到一个解决方案,但似乎没有一个能起作用的。
谢谢!

你能展示一下 cap production doctor 的输出吗?如果有敏感信息,请确保进行删除。 - Matt Brictson
3个回答

15

我解决了它,并对解决方案感到惊讶...

我在/shared/public/assets目录下创建了两个空文件,分别命名为.manifest.json和.sprockets-manifest.json,结果它起作用了。


3
在我的情况下,我通过在 shared/public/assets 中创建一个空文件 manifest.json(不带点)来解决了我的问题。 - Tsutomu

12
如果你在Rails应用中使用webpacker,并完全禁用了Sprockets,在尝试部署时可能会遇到以下错误:Rails assets manifest file not found. 这个错误出现在deploy:assets:backup_manifest任务中。
这个任务是为Sprockets构建的,不适用于webpacker。通过向config/deploy.rb添加以下行来跳过它:
Rake::Task["deploy:assets:backup_manifest"].clear_actions

https://makandracards.com/makandra/100898-fix-for-rails-assets-manifest-file-not-found-in-capistrano-deploy


4
为了防止deploy:rollback崩溃,添加Rake::Task["deploy:assets:restore_manifest"].clear_actions是个好主意。查看这个答案获取更多信息。 - torce
这同样适用于使用其他打包工具,如vite,而不使用/需要sprockets。 - Martin M

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接