Reputation: 895
Does anyone ever got this error after run :
cap production deploy
I'm Using capistrano : Capistrano Version: 3.6.1 (Rake Version: 11.3.0)
Here is the log :
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as [email protected]: rake exit status: 1
rake stdout: rake aborted!
Don't know how to build task 'assets:precompile' (see --tasks)
/home/deploy/microwave-api/shared/bundle/ruby/2.3.0/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
.
.
.
/home/deploy/.rvm/gems/ruby-2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/home/deploy/.rvm/gems/ruby-2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/home/deploy/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)
rake stderr: Nothing written
SSHKit::Command::Failed: rake exit status: 1
rake stdout: rake aborted!
Don't know how to build task 'assets:precompile' (see --tasks)enter code here
Upvotes: 14
Views: 7051
Reputation: 3674
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::Git
require "capistrano/rbenv"
set :rbenv_type, :user
set :rbenv_ruby, "2.5.1"
require 'capistrano/bundler'
require 'capistrano/rails/migrations'
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
Upvotes: 7
Reputation: 2653
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
.
Upvotes: 33