简体   繁体   中英

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:

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:

  # 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:

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. I'm not sure how to fix this,

any idea?

thanks

“不知道如何构建任务”错误可能是由于Capfile中的'require'行以错误的顺序引起的。

The Capfile was missing the line:

 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.

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. I was already heading out for google looking for solutions, until I realized that the project was not set up for capistrano at all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM