Rails manifest file not found (deploying with Capistrano)
Asked Answered
S

3

13

I'm trying to deploy a rails app using Capistrano, but it fails because there's no manifest file.

This is what I get when I run 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.

Any idea how to solve this issue? I've tried to find a solution but none of them seem to work.

Thank you!

Spinthariscope answered 20/12, 2017 at 20:46 Comment(1)
Can you show us the output of cap production doctor? Make sure to redact sensitive information, if any.Diphenylamine
S
16

I solved it, and I'm surprised with the solution...

I created two empty files in /shared/public/assets called .manifest.json and .sprockets-manifest.json, and it worked.

Spinthariscope answered 25/12, 2017 at 23:25 Comment(1)
In my case, I solved my problem by creating an empty file manifest.json (without dot) in shared/public/assets.Ginnifer
C
13

If you use webpacker in your Rails application, and you have completely disabled Sprockets, you might get the following error when trying to deploy: Rails assets manifest file not found. This happens inside the deploy:assets:backup_manifest task.

This task is build for Sprockets and does not work with webpacker. Simply skip it, by adding the following line to your 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

Crude answered 19/12, 2019 at 9:27 Comment(2)
It's a good idea to add also Rake::Task["deploy:assets:restore_manifest"].clear_actions to prevent deploy:rollback from crashing. Check this answer for more info.Lopeared
This also applies to using other packers like vite and not using / needing sprocketsMagnetics
J
0

@Paul Odeon's answer worked for me, and this also worked:

set :assets_prefix, 'packs'

Found at https://github.com/capistrano/rails/issues/235

Jailbreak answered 21/1, 2022 at 22:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.