简体   繁体   English

部署引发错误“不知道如何构建任务'资产:预编译'”(Capistrano)

[英]Deploy raise error “Don't know how to build task 'assets:precompile'” (Capistrano)

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) 我正在使用capistrano:Capistrano版本:3.6.1(耙子版本:11.3.0)

Here is the log : 这是日志:

(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@54.169.99.36: 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

Sounds like you probably don't have Sprockets set up (an API only application?). 听起来你可能没有设置Sprockets(一个只有API的应用程序?)。

In your Capfile, you probably have something like: 在你的Capfile中,你可能有类似的东西:

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. 如果不是这种情况,问题是您不包括Sprockets,您需要研究它。 I'd generate a new rails app and compare your Gemfile and config/application.rb . 我将生成一个新的rails应用程序并比较你的Gemfileconfig/application.rb

If you rails application is API only, do not add require 'capistrano/rails/assets' or require "capistrano/rails" . 如果rails应用程序仅是API,请不要添加require 'capistrano/rails/assets'或者require "capistrano/rails"

Add following: 添加以下:

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

At the end your Capfile will look something like this: 最后你的Capfile看起来像这样:

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 }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Capistrano:不知道如何构建任务“ deploy:restart” - Capistrano : Don't know how to build task 'deploy:restart' Rails 5部署到VPS-capistrano错误“不知道如何构建任务&#39;deploy:setup&#39;” - Rails 5 deploy to VPS - capistrano error “Don't know how to build task 'deploy:setup' ” capistrano 3.0.1当使用capistrano / rails / assets时,不知道如何构建任务&#39;starting&#39; - capistrano 3.0.1 Don't know how to build task 'starting' when using capistrano/rails/assets Capistrano部署 - 资产预编译错误 - Capistrano deploy - assets precompile error 当我在 Capistrano 任务中将我的应用程序部署到 vps 时,不知道如何构建任务“环境” - Don't know how to build task 'environment' When i deploy my app to vps in Capistrano task Capistrano:不知道如何构建任务 &#39;deploy:new_release_path&#39; - Capistrano: Don't know how to build task 'deploy:new_release_path' Capistrano:Cap失败了! 不知道如何建立任务&#39;deploy:setup&#39; - Capistrano: Cap aborted! Don't know how to build task 'deploy:setup' capistrano3:不知道如何构建任务&#39;deploy:create_db&#39; - capistrano3: Don't know how to build task 'deploy:create_db' Capistrano 任务部署:资产:预编译需要一个小时 - Capistrano task deploy:assets:precompile takes an hour 卡皮斯特拉诺:帽子流产了! 不知道如何构建任务&#39;deploy:setup_config&#39; - Capistrano: cap aborted! Don't know how to build task 'deploy:setup_config'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM