简体   繁体   English

当我尝试安装任何gem时,MongoDB连接错误

[英]MongoDB connection error when I try to install any gem

I am trying to run Rails 3.2.3 using gem 1.8.23, Ruby 1.9.2p318 (2012-02-14 revision 34678) [x86_64-darwin10.8.0], MongoDB 1.6.2 with MongoMapper 0.11.0 and heroku. 我正在尝试使用gem 1.8.23,Ruby 1.9.2p318(2012-02-14修订版34678)[x86_64-darwin10.8.0],带有MongoMapper 0.11.0的MongoDB 1.6.2和heroku运行Rails 3.2.3。 I am able to start the rails server and use mongoDB both on development and on heroku. 我能够启动rails服务器并在开发和heroku上使用mongoDB。 But whenever I try to install anything new (bootstrap for instance) or run 'rails s' command, I get the following error (pasted below). 但是,每当我尝试安装新的东西(例如,引导程序)或运行“ rails s”命令时,都会收到以下错误(粘贴在下面)。 I assume it has something to do with mongodb and or mongo mapper. 我认为这与mongodb和或mongo映射器有关。 I have also enclosed the config files. 我还附上了配置文件。 I've been stuck with this since couple of days and any hints or ideas are highly appreciated. 几天以来,我一直坚持这一点,任何提示或想法都受到高度赞赏。 Unfortunately, this is my first RoR app and hence I may sound really stupid. 不幸的是,这是我的第一个RoR应用程序,因此我听起来可能很蠢。

Error: 错误:


new-host:talker Name$ rails g bootstrap:install
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from  at /Users/Name/Projects/talker/config/environment.rb:12)
/Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/networking.rb:330:in `rescue in receive_message_on_socket': Operation failed with the following exception: connection closed (Mongo::ConnectionFailure)
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/networking.rb:322:in `receive_message_on_socket'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/networking.rb:188:in `receive_header'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/networking.rb:175:in `receive'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/networking.rb:139:in `receive_message'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/cursor.rb:469:in `block in send_initial_query'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/util/logging.rb:36:in `instrument'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/cursor.rb:467:in `send_initial_query'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/cursor.rb:458:in `refresh'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/cursor.rb:128:in `next'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/db.rb:511:in `command'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/connection.rb:628:in `check_is_master'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/connection.rb:402:in `connect'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/connection.rb:589:in `setup'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/connection.rb:114:in `initialize'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo_mapper-0.11.1/lib/mongo_mapper/connection.rb:75:in `new'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo_mapper-0.11.1/lib/mongo_mapper/connection.rb:75:in `connect'
    from /Users/Name/Projects/talker/config/initializers/mogo.rb:28:in `'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in `load'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in `block in load'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in `load'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/engine.rb:588:in `block (2 levels) in '
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/engine.rb:587:in `each'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/engine.rb:587:in `block in '
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `instance_exec'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `run'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `each'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `run_initializers'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/application.rb:136:in `initialize!'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /Users/Name/Projects/talker/config/environment.rb:12:in `'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/application.rb:103:in `require'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/application.rb:103:in `require_environment!'
    from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/commands.rb:25:in `'
    from script/rails:6:in `require'
    from script/rails:6:in `'
new-host:talker Name$ 

environment.rb environment.rb


require File.expand_path('../application', FILE)
Talker::Application.initialize!

mongo.rb mongo.rb


MongoMapper.config = { 
  Rails.env => { 'uri' => ENV['MONGOHQ_URL'] || 'mongodb://localhost:28017' } }
MongoMapper.connect(Rails.env)
if defined?(PhusionPassenger)
   PhusionPassenger.on_event(:starting_worker_process) do |forked|
     MongoMapper.connection.connect if forked
   end
end

Your config file says to connect to localhost:28017, but that's the web console. 您的配置文件说要连接到localhost:28017,但这是Web控制台。 You probably want localhost:27017. 您可能需要localhost:27017。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当我尝试安装pg gem时导致此错误的原因是什么? - What is causing this error when I try to install the pg gem? 当我尝试 gem install bootsnap -v '1.7.2 时出现错误 - A error came when i try gem install bootsnap -v '1.7.2 当我尝试在 Ubuntu 上安装 gem bundler 时,为什么会收到这些错误消息? (无法创建 Makefile) - Why I obtain these error messages when I try to install gem bundler on Ubuntu? (Could not create Makefile) 尝试启动Rails控制台时出现Spring gem错误 - Error with Spring gem when I try to start rails console 我执行捆绑安装时遇到kgio gem的宝石安装错误 - I am getting this gem install error for kgio gem when i do a bundle install 错误:无法在任何存储库中找到有效的gem'摘要'(> = 0) - 为什么我不能安装/找到Digest gem? - ERROR: Could not find a valid gem 'digest' (>= 0) in any repository - Why can't I install/find the Digest gem? 宝石安装(任何宝石)在ubuntu 12.04 32位上导致错误 - Gem install (of any gem) results in error on ubuntu 12.04 32 bit 尝试安装RSpec时为什么会出现此错误? - Why am I getting this error when I try to install RSpec? 错误安装任何gem包::: gem install rails或gem install dashing - Error installing any gem packages ::: gem install rails or gem install dashing 当我尝试捆绑安装Nokogiri时Bundler错误 - Bundler error when I try to do bundle install Nokogiri
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM