mac os X上类HTTP的超类不匹配

时间:2011-08-17 08:26:22

标签: ruby-on-rails

我在Mac上安装Ruby on Rails环境时遇到了一些麻烦,我正在尝试使用这个版本:

  • ruby​​ 1.8.7(2011-06-30 patchlevel 352)[i686-darwin10.7.1]

  • gem 1.8.6

  • Snow Leopard 10.6.8

我认为默认情况下XCode会安装一些与我的某些宝石冲突的ruby库。要安装ruby,我使用过“rvm install 1.8.7”

这是错误的堆栈跟踪:

/Users/raimonbosch//.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/net/http.rb:278
activesupport (3.0.3) lib/active_support/dependencies.rb:239:in `require'
activesupport (3.0.3) lib/active_support/dependencies.rb:239:in `require'
activesupport (3.0.3) lib/active_support/dependencies.rb:225:in `load_dependency'
activesupport (3.0.3) lib/active_support/dependencies.rb:596:in `new_constants_in'
activesupport (3.0.3) lib/active_support/dependencies.rb:225:in `load_dependency'
activesupport (3.0.3) lib/active_support/dependencies.rb:239:in `require'
/Users/raimonbosch//.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/net/https.rb:101
activesupport (3.0.3) lib/active_support/dependencies.rb:239:in `require'
activesupport (3.0.3) lib/active_support/dependencies.rb:239:in `require'
activesupport (3.0.3) lib/active_support/dependencies.rb:225:in `load_dependency'
activesupport (3.0.3) lib/active_support/dependencies.rb:596:in `new_constants_in'
activesupport (3.0.3) lib/active_support/dependencies.rb:225:in `load_dependency'
activesupport (3.0.3) lib/active_support/dependencies.rb:239:in `require'
activesupport (3.0.3) lib/active_support/dependencies.rb:454:in `load'
activesupport (3.0.3) lib/active_support/dependencies.rb:454:in `load_file'
activesupport (3.0.3) lib/active_support/dependencies.rb:596:in `new_constants_in'
activesupport (3.0.3) lib/active_support/dependencies.rb:453:in `load_file'
activesupport (3.0.3) lib/active_support/dependencies.rb:340:in `require_or_load'
activesupport (3.0.3) lib/active_support/dependencies.rb:491:in `load_missing_constant'
activesupport (3.0.3) lib/active_support/dependencies.rb:183:in `const_missing'
activesupport (3.0.3) lib/active_support/dependencies.rb:181:in `each'
activesupport (3.0.3) lib/active_support/dependencies.rb:181:in `const_missing'
activesupport (3.0.3) lib/active_support/inflector/methods.rb:113:in `constantize'
activesupport (3.0.3) lib/active_support/inflector/methods.rb:112:in `each'
activesupport (3.0.3) lib/active_support/inflector/methods.rb:112:in `constantize'
activesupport (3.0.3) lib/active_support/dependencies.rb:528
activesupport (3.0.3) lib/active_support/dependencies.rb:538:in `call'
activesupport (3.0.3) lib/active_support/dependencies.rb:538:in `default'
activesupport (3.0.3) lib/active_support/dependencies.rb:538:in `[]'
activesupport (3.0.3) lib/active_support/dependencies.rb:538:in `get'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:58:in `controller_reference'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:44:in `controller'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:23:in `call'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:148:in `call'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:93:in `recognize'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:68:in `optimized_each'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:92:in `recognize'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:139:in `call'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:492:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.3) lib/rack/methodoverride.rb:24:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/flash.rb:182:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/cookies.rb:295:in `call'
activerecord (3.0.3) lib/active_record/query_cache.rb:32:in `call'
activerecord (3.0.3) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
activerecord (3.0.3) lib/active_record/query_cache.rb:12:in `cache'
activerecord (3.0.3) lib/active_record/query_cache.rb:31:in `call'
activerecord (3.0.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:353:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/callbacks.rb:46:in `call'
activesupport (3.0.3) lib/active_support/callbacks.rb:415:in `_run_call_callbacks'
actionpack (3.0.3) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.3) lib/rack/sendfile.rb:107:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/show_exceptions.rb:46:in `call'
railties (3.0.3) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.3) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.3) lib/rack/lock.rb:11:in `call'
rack (1.2.3) lib/rack/lock.rb:11:in `synchronize'
rack (1.2.3) lib/rack/lock.rb:11:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/static.rb:30:in `call'
railties (3.0.3) lib/rails/application.rb:168:in `call'
railties (3.0.3) lib/rails/application.rb:77:in `send'
railties (3.0.3) lib/rails/application.rb:77:in `method_missing'
railties (3.0.3) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.3) lib/rack/content_length.rb:13:in `call'
rack (1.2.3) lib/rack/handler/webrick.rb:52:in `service'
/Users/raimonbosch//.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/Users/raimonbosch//.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/Users/raimonbosch//.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/Users/raimonbosch//.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:162:in `start'
/Users/raimonbosch//.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/Users/raimonbosch//.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:95:in `start'
/Users/raimonbosch//.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:92:in `each'
/Users/raimonbosch//.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:92:in `start'
/Users/raimonbosch//.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:23:in `start'
/Users/raimonbosch//.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:82:in `start'
rack (1.2.3) lib/rack/handler/webrick.rb:13:in `run'
rack (1.2.3) lib/rack/server.rb:217:in `start'
railties (3.0.3) lib/rails/commands/server.rb:65:in `start'
railties (3.0.3) lib/rails/commands.rb:30
railties (3.0.3) lib/rails/commands.rb:27:in `tap'
railties (3.0.3) lib/rails/commands.rb:27
script/rails:6:in `require'
script/rails:6

提前致谢,

Raimon Bosch。

1 个答案:

答案 0 :(得分:0)

最后,我们在存储库中找到了另一个具有相同名称的类:

cd $HOME/.rvm/gems
find . -name *.rb | xargs grep 'class HTTP'

然后我们在net.ssh-2.1.4上看到一个HTTP类

./ruby-1.8.7-p352/gems/net-ssh-2.1.4/lib/net/ssh/proxy/http.rb:  class HTTP

为解决这个问题,我们强制要求'net / http'并在应用程序开头需要'net / https'。如果aplication要求默认gems首先需要net-ssh-2.1.4的HTTP类,那么我们就无法使用Net:HTTP。