Deploy raise error "Don't know how to build task 'assets:precompile'" (Capistrano) Deploy raise error "Don't know how to build task 'assets:precompile'" (Capistrano) ruby-on-rails ruby-on-rails

Deploy raise error "Don't know how to build task 'assets:precompile'" (Capistrano)


Sounds like you probably don't have Sprockets set up (an API only application?).

In your Capfile, you probably have something like:

require 'capistrano/rails'

That line actually requires a file which looks like:

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

So you can replace the former line with just:

require 'capistrano/rails/migrations'

and the asset precompilation will no longer be run.

As mentioned above, this assumes that you don't actually want to use the asset pipeline. If this isn't the case, the issue is that you aren't including Sprockets and you need to look into that. I'd generate a new rails app and compare your Gemfile and config/application.rb.


If you rails application is API only, do not add require 'capistrano/rails/assets' or require "capistrano/rails".

Add following:

require 'capistrano/bundler'require 'capistrano/rails/migrations'

At the end your Capfile will look something like this:

require "capistrano/setup"require "capistrano/deploy"require "capistrano/scm/git"install_plugin Capistrano::SCM::Gitrequire "capistrano/rbenv"set :rbenv_type, :userset :rbenv_ruby, "2.5.1"require 'capistrano/bundler'require 'capistrano/rails/migrations'# Load custom tasks from `lib/capistrano/tasks` if you have any definedDir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }