3

如果我跑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>'

宝石文件

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-ssh. net-sshgem 从 2.4 -> 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 文件中删除与您的服务器相关的行
  • 您现在可以部署一次。在每次部署之前重复。
4

3 回答 3

2

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

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

bundle update net-ssh

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

gem "net-ssh", "~> 2.5.1"
于 2012-05-24T13:25:14.987 回答
1

我认为这是 capistrano gem 的错误。我刚刚为我的项目执行了包更新并且有同样的错误,但是如果我从 Gemfile 中删除 capistrano,一切正常。

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

于 2012-05-24T13:04:30.107 回答
0

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

于 2012-05-30T11:56:35.777 回答