部署引发错误“不知道如何构建任务‘资产:预编译’";(卡皮斯特拉诺) [英] Deploy raise error "Don't know how to build task 'assets:precompile'" (Capistrano)

查看:50
本文介绍了部署引发错误“不知道如何构建任务‘资产:预编译’";(卡皮斯特拉诺)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人在运行后遇到过这个错误:

Does anyone ever got this error after run :

cap production deploy

我正在使用 capistrano:Capistrano 版本:3.6.1(Rake 版本:11.3.0)

I'm Using capistrano : Capistrano Version: 3.6.1 (Rake Version: 11.3.0)

这是日志:

(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

推荐答案

听起来您可能没有设置 Sprockets(仅限 API 的应用程序?).

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

在您的 Capfile 中,您可能有以下内容:

In your Capfile, you probably have something like:

require 'capistrano/rails'

该行实际上需要一个看起来像的文件喜欢:

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.

如上所述,这假设您实际上并不想使用资产管道.如果不是这种情况,问题是您没有包括链轮,您需要调查一下.我会生成一个新的 rails 应用程序并比较您的 Gemfileconfig/application.rb.

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.

这篇关于部署引发错误“不知道如何构建任务‘资产:预编译’";(卡皮斯特拉诺)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆