我正在尝试使用gem 1.8.23,Ruby 1.9.2p318(2012-02-14修订版34678)[x86_64-darwin10.8.0],MongoDB 1.6.2和MongoMapper 0.11.0以及heroku运行Rails 3.2.3 。 我能够启动rails服务器并在开发和heroku上使用mongoDB。但每当我尝试安装任何新东西(例如bootstrap)或运行'rails s'命令时,我都会收到以下错误(粘贴在下面)。我认为它与mongodb和/或mongo mapper有关。我还附上了配置文件。自从几天以来,我一直坚持这一点,任何提示或想法都受到高度赞赏。不幸的是,这是我的第一个RoR应用程序,因此我听起来真的很愚蠢。
错误:
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
require File.expand_path('../application', FILE)
Talker::Application.initialize!
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
答案 0 :(得分:0)
您的配置文件说连接到localhost:28017,但这是Web控制台。你可能想要localhost:27017。