[英]capistrano 3.0.1 Don't know how to build task 'starting' when using capistrano/rails/assets
When trying to deploy with Capistrano 3.0.1 I get the following error: 尝试使用Capistrano 3.0.1进行部署时出现以下错误:
cap aborted!
Don't know how to build task 'starting'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/capistrano-3.0.1/lib/capistrano/dsl/task_enhancements.rb:5:in `before'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/capistrano-rails-1.1.0/lib/capistrano/tasks/assets.rake:9:in `block in <top (required)>'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/capistrano-rails-1.1.0/lib/capistrano/tasks/assets.rake:8:in `<top (required)>'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/capistrano-rails-1.1.0/lib/capistrano/rails/assets.rb:1:in `load'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/capistrano-rails-1.1.0/lib/capistrano/rails/assets.rb:1:in `<top (required)>'
/Users/user/Documents/rails/shop/Capfile:18:in `require'
/Users/user/Documents/rails/shop/Capfile:18:in `<top (required)>'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/capistrano-3.0.1/lib/capistrano/application.rb:22:in `load_rakefile'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/capistrano-3.0.1/lib/capistrano/application.rb:12:in `run'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/capistrano-3.0.1/bin/cap:3:in `<top (required)>'
/Users/user/.rvm/gems/ruby-2.0.0-p353/bin/cap:23:in `load'
/Users/user/.rvm/gems/ruby-2.0.0-p353/bin/cap:23:in `<main>'
/Users/user/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `eval'
/Users/user/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)
This seems to have started when I uncommented the require rows for loading assets and performing migrations in the Capfile: 当我取消注释需要行以加载资产并在Capfile中执行迁移时,这似乎已经开始了:
# Load DSL and Setup Up Stages
require 'capistrano/setup'
# Includes tasks from other gems included in your Gemfile
#
# require 'capistrano/rvm'
# require 'capistrano/rbenv'
# require 'capistrano/chruby'
# require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
and adding the gems to the Gemfile: 并将Gems添加到Gemfile:
gem 'capistrano', '~> 3.0.0'
gem 'capistrano-rails', '~> 1.1.0'
It's like the required assets are loaded before the default capistrano tasks so they fail because a the time of loading the starting
is not yet defined. 这就像在默认的capistrano任务之前加载了所需的资产,因此它们会失败,因为尚未定义加载starting
的时间。 I'm not sure how to fix this, 我不知道如何解决这个问题,
any idea? 任何的想法?
thanks 谢谢
“不知道如何构建任务”错误可能是由于Capfile中的'require'行以错误的顺序引起的。
The Capfile
was missing the line: Capfile
错过了这一行:
require 'capistrano/deploy'
this is responsible of loading the deployment tasks. 这负责加载部署任务。
Missing that requirement the tasks won't be loaded and they will be missing. 缺少该要求,任务将不会被加载,并且将丢失。
Try capistrano from master, and the rails gem from master too. 试试master中的capistrano,以及来自master的rails gem。
There's a new release of both pending, so might be best to jump the gun: 两个都有待发布的新版本,所以最好跳枪:
gem 'capistrano', github: 'capistrano/capistrano', ref: 'master'
gem 'capistrano-rails', github: 'capistrano/rails', ref: 'master'
I did run cap -T
and got the same error. 我确实运行了cap -T
并得到了同样的错误。 I was already heading out for google looking for solutions, until I realized that the project was not set up for capistrano at all. 我已经开始寻找谷歌寻找解决方案,直到我意识到该项目根本没有设置为capistrano。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.