Capistrano安装错误

时间:2017-10-03 18:19:03

标签: ruby-on-rails capistrano

我尝试在我的项目中安装capistrano gem并捕获错误:

  

未初始化的常量Capistrano :: Configuration :: SSHKit(NameError)

完整日志:

bundle exec cap install
/home/ubuntu/.rvm/gems/ruby-2.4.0/gems/capistrano-3.9.1/lib/capistrano/configuration/server.rb:4:in `<class:Configuration>': uninitialized constant Capistrano::Configuration::SSHKit (NameError)
from /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/capistrano-3.9.1/lib/capistrano/configuration/server.rb:3:in `<module:Capistrano>'
from /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/capistrano-3.9.1/lib/capistrano/configuration/server.rb:2:in `<top (required)>'
from /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/capistrano-3.9.1/lib/capistrano/configuration.rb:4:in `require_relative'
from /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/capistrano-3.9.1/lib/capistrano/configuration.rb:4:in `<top (required)>'
from /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/capistrano-3.9.1/lib/capistrano/configuration/filter.rb:1:in `require'
from /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/capistrano-3.9.1/lib/capistrano/configuration/filter.rb:1:in `<top (required)>'
from /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/capistrano-3.9.1/lib/capistrano/dsl.rb:5:in `require'
from /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/capistrano-3.9.1/lib/capistrano/dsl.rb:5:in `<top (required)>'
from /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/capistrano-3.9.1/lib/capistrano/all.rb:11:in `require'
from /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/capistrano-3.9.1/lib/capistrano/all.rb:11:in `<top (required)>'
from /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/capistrano-3.9.1/bin/cap:2:in `require'
from /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/capistrano-3.9.1/bin/cap:2:in `<top (required)>'
from /home/ubuntu/.rvm/gems/ruby-2.4.0/bin/cap:22:in `load'
from /home/ubuntu/.rvm/gems/ruby-2.4.0/bin/cap:22:in `<main>'
from /home/ubuntu/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `eval'
from /home/ubuntu/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `<main>'

Ubuntu服务器16.04 Ruby 2.4.0 Rails 5.1.4

如何解决?

UPD 1

ubuntu@rails-serv-1:/var/www/cargo$ bundle exec gem list cap ssh

*** LOCAL GEMS ***

capistrano (3.9.1)
capistrano-bundler (1.3.0)
capistrano-rails (1.3.0)
capistrano-rvm (0.1.2)
capistrano3-puma (3.1.1)
capybara (2.15.2)
invisible_captcha (0.9.3)

*** LOCAL GEMS ***

airbrussh (1.3.0)
net-ssh (4.2.0)
sshkit (1.14.0)

1 个答案:

答案 0 :(得分:0)

我有相同的Capistrano版本,bundle exec cap install对我来说很好。

*** LOCAL GEMS ***

capistrano (3.9.1)

*** LOCAL GEMS ***

airbrussh (1.3.0)
net-ssh (4.2.0)
sshkit (1.14.0)

我唯一的猜测是你的Gemfile中的额外capistrano-宝石导致了这个问题。

如果您还没有这样做,我建议您为Gemfile添加require: false 所有与Capistrano相关的宝石。

E.g。

gem "capistrano", require: false
gem "capistrano-bundler", require: false
gem "capistrano-rails", require: false
gem "capistrano-rvm", require: false
gem "capistrano3-puma", require: false

另外,我建议完全删除capistrano-rvm。那颗宝石很老了,可能不再与卡皮斯特拉诺合作了,而且似乎被抛弃了:

https://github.com/capistrano/rvm/issues/83