0

Please, I have the same problem: Deploy error ruby on rails Don't know how to build task 'assets:precompile'?

If it's possible, helpme and help this guy too.

Thanks in advance for your attention

Update:

With @Anuj help, I find the solution: Precisely because my project is API by default, I don't have the precompile assets (@Anuj said the same, I didn't know). The solution to me is:

-> remove inside my Capfile: require 'capistrano/rails/assets'

-> remove inside my deploy.rb after :finishing, :compile_assets

1 Answers1

4

assets:precompile is a task provided by Sprockets, which does not get included by default in an API only app (because APIs don't need assets).

In your Capfile, when you write

require 'capistrano/rails'

it basically includes both the below lines automatically

require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'

If you replace the capistrano/rails with just capistrano/rails/migrations in your Capfile, that should solve your problem.

Anuj
  • 1,912
  • 1
  • 12
  • 19
  • Thanks for your response. I understand what you told me about the API. However, I added what you say into my Capfile, but the error keeps showing up: ```deploy:assets:precompile 01 $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile 01 rake aborted!``` – Lucas Raphael Dec 29 '20 at 12:41
  • But, I find the solution because this and I edit my ask. So, I mark your reply with accepted. Thanks for your help @Anuj. And If is possible, I have another most difficult question about the PUMA: https://stackoverflow.com/q/65492028/8478892 – Lucas Raphael Dec 29 '20 at 13:01