Capistrano 3:未定义的方法'着色' for:location:首次部署尝试时的符号

时间:2014-08-19 22:52:40

标签: capistrano capistrano3

我正在尝试使用capistrano 3.2.1从Windows机器到远程主机通过ssh设置部署。但是在第一次运行时我收到以下错误:

上限生产部署--trace --verbose

SSHKit::Runner::ExecuteError: Exception while executing on host #<Capistrano::Configuration::Server:0x29b1460>: undefined method `colorize' for :location:Symbol
(eval):4:in `blue'
C:/tools/Ruby193/lib/ruby/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/formatters/pretty.rb:22:in `write_command'
C:/tools/Ruby193/lib/ruby/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/formatters/pretty.rb:10:in `write'
C:/tools/Ruby193/lib/ruby/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:129:in `block in _execute'
C:/tools/Ruby193/lib/ruby/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `tap'
C:/tools/Ruby193/lib/ruby/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `_execute'
C:/tools/Ruby193/lib/ruby/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:66:in `execute'
C:/tools/Ruby193/lib/ruby/gems/1.9.1/gems/capistrano-3.2.1/lib/capistrano/tasks/git.rake:17:in `block (3 levels) in <top (required)>'
C:/tools/Ruby193/lib/ruby/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
C:/tools/Ruby193/lib/ruby/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `run'
C:/tools/Ruby193/lib/ruby/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
NoMethodError: undefined method `colorize' for :location:Symbol
(eval):4:in `blue'

我已经设置了这样的版本:

deploy.rb

lock '3.2.1'

set :application, 'myapp.com'
set :user, "deploy"
set :repo_url, 'git@bitbucket.org:me/myapp.com.git'
set :use_sudo, false
set :deploy_to, '/var/www/#{application}'
set :ssh_options, { :forward_agent => true }
set :deploy_via, :remote_cache
set :pty, true

Capfile

require 'capistrano/setup'
require 'capistrano/deploy'

Production.rb

set :location, "myapp.com"
role :app, :location
role :web, :location
role :db,  :location, :primary => true

server 'myapp.com', :roles => [:app, :web, :db], :primary => true

已安装的宝石和版本:

*** LOCAL GEMS ***

bigdecimal (1.1.0)
capistrano (3.2.1)
chunky_png (1.2.9)
colorize (0.7.3)
compass (0.12.2)
foundation (1.0.4)
fssm (0.2.10)
i18n (0.6.11)
io-console (0.3)
json (1.5.5)
minitest (2.5.1)
net-scp (1.2.1)
net-ssh (2.9.1)
rake (10.3.2, 0.9.2.2)
rdoc (3.9.5)
rubygems-update (2.1.11)
sass (3.2.12)
sshkit (1.5.1)
thor (0.18.1)

有谁知道该怎么做或如何调试这个?我从谷歌搜索中找不到任何东西......我看到有关彩色宝石的东西必须是0.6+,但如上所示,我有最新的(0.7.3 atm)。

1 个答案:

答案 0 :(得分:0)

好吧,发现:这似乎与Ruby gem中的版本兼容性有关。发现,它在我的另一台笔记本电脑上工作,然后比较配置 - 工作机器正在运行

  

sshkit(1.3.0)

我将sshkit从v。1.5.1降级为1.3.0,后者解决了它。