无法加载此类文件 - net / ssh / authentication / agent / socket(LoadError)

时间:2012-05-24 12:58:30

标签: ruby-on-rails rubygems capistrano net-ssh

如果我运行rails s

/Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- net/ssh/authentication/agent/socket (LoadError)
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/net-ssh-2.5.0/lib/net/ssh/authentication/agent.rb:22:in `<top (required)>'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/net-ssh-2.5.0/lib/net/ssh/authentication/key_manager.rb:4:in `<top (required)>'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/net-ssh-2.5.0/lib/net/ssh/authentication/session.rb:4:in `<top (required)>'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/net-ssh-2.5.0/lib/net/ssh.rb:11:in `<top (required)>'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/net-ssh-gateway-1.1.0/lib/net/ssh/gateway.rb:2:in `<top (required)>'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.12.0/lib/capistrano/configuration/connections.rb:2:in `<top (required)>'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.12.0/lib/capistrano/configuration.rb:5:in `<top (required)>'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.12.0/lib/capistrano.rb:3:in `<top (required)>'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.1.3/lib/bundler/runtime.rb:68:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.1.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.1.3/lib/bundler/runtime.rb:66:in `each'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.1.3/lib/bundler/runtime.rb:66:in `block in require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `each'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.1.3/lib/bundler.rb:119:in `require'
    from /Users/frankie/projects/unitedfreelance/config/application.rb:13:in `<top (required)>'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.0/lib/rails/commands.rb:53:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.0/lib/rails/commands.rb:53:in `block in <top (required)>'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.0/lib/rails/commands.rb:50:in `tap'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.0/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

的Gemfile

source 'http://rubygems.org'

gem 'rails', '3.2.0'

# Bundle edge Rails instead:
# gem 'rails',     :git => 'git://github.com/rails/rails.git'

gem 'pg'
gem "cocoon"
gem 'nokogiri'
gem 'hpricot'
gem "formtastic", "~> 2.1.1"
gem "activeadmin", "~> 0.4.4"
gem 'omniauth'
gem 'country-select'
gem "paperclip", "~> 3.0"
gem 'cancan'
gem 'rolify'

gem "meta_search",    '>= 1.1.0.pre'
gem 'bourbon', "~> 2.0.0.rc1"
gem "rails-boilerplate"
gem 'geocoder'
gem 'httparty'
gem 'hashie'
gem 'will_paginate', :git => "git://github.com/mislav/will_paginate.git"
gem 'thinking-sphinx', '2.0.10'
gem 'sanitize'
gem 'feedzirra'
gem "crypt19", "~> 1.2.1"
gem 'wicked_pdf'
gem 'forem', :git => "git://github.com/radar/forem.git"
gem 'thin'
gem 'whenever', :require => false
gem "ckeditor", "3.7.1"
# gem 'sisow'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
end

gem 'haml-rails' 
gem 'jquery-rails'

group :development do
    gem 'ruby_parser'
end

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the web server
gem 'unicorn'

# Deploy with Capistrano
gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

一秒钟它起作用,下一个它不起作用。

在我尝试按照本指南修复CKeditor集成后,我停止了工作: https://github.com/galetahub/ckeditor

更新

发生此错误是因为我使用的是Capistrano,并且该gem需要net-sshnet-ssh宝石已从2.4更新 - &gt; 2.5.0导致了这个问题。

更新了我的Gemfile:

gem 'rails', '3.2.0'
gem "net-ssh", "~> 2.4.0"

然后运行$ gem update net-ssh

rails s命令的错误消失了。尚未使用Capistrano进行部署,因此不能说使用部署是否存在错误。

更新2

Capistrano未能部署,因此搞砸了。使用cap deploy时,我会收到您在帖子开头看到的错误消息。

更新3

net-ssh升级为2.5.1,因为在评论中有人提到2.5.0已被破坏。 升级后,需求问题已解决,但Capistrano仍然无法部署。

[deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: 85.xxx.xxx.xxx (NameError: uninitialized constant Net::SSH::KnownHosts::SUPPORTED_TYPE)
connection failed for: 85.xxx.xxx.xxx (NameError: uninitialized constant Net::SSH::KnownHosts::SUPPORTED_TYPE)

更新4(加上解决方法)

在下面的评论中发布了一种解决方法。

  • 将您的net-ssh版本保留在2.5.1
  • 在使用Capistrano进行部署之前,请从〜/ .ssh / known_hosts文件中删除服务器的行
  • 您现在可以部署一次。每次部署前重复。

3 个答案:

答案 0 :(得分:2)

降级到2.4.0允许rails s工作,但cap命令失败。

确保通过发出以下命令使用2.5.1:

bundle update net-ssh

您也可以将其添加到您的Gemfile:

gem "net-ssh", "~> 2.5.1"

答案 1 :(得分:1)

我认为这是capistrano gem中的一个错误。我刚刚为我的项目执行了bundle更新并且出现了同样的错误,但如果我从Gemfile中删除capistrano,一切都会正常工作。

UPD:Capistrano gem使用net-ssh gem,这是在1小时前更新的。

答案 2 :(得分:0)

Gem版本2.5.2为我解决了这个问题。