2010-07-15 127 views
2

有一個類似的問題'bson_ext',但它不適合我。MongoId和bson_ext問題:沒有這樣的文件加載 - bson_ext

MongoMapper and bson_ext problem

我用Rails 2.3.8 + MongoId 1.9.1。我跟着 「installation」 頁面:

gem install mongoid 
gem install mongo -v=1.0.4 
gem install bson_ext -v=1.0.4 

在我的config/environment.rb中,我說:

config.gem 'mongoid' 
config.gem 'mongo', :version=>'1.0.4' 
config.gem 'bson_ext', :verstion=>'1.0.4' 

當我開始ruby script/server的應用程序,它顯示:

=> Booting WEBrick 
=> Rails 2.3.8 application starting on http://0.0.0.0:3000 
no such file to load -- bson_ext 
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' 
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require' 
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in' 
... 
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' 
script/server:3 
Missing these required gems: 
    bson_ext = 1.0.4 

You're running: 
    ruby 1.8.7.299 at /usr/local/bin/ruby 
    rubygems 1.3.7 at /root/.gem/ruby/1.8, /usr/local/lib/ruby/gems/1.8 

Run `rake gems:install` to install the missing gems. 

但我已經安裝了bson_ext 1.0.4

gem list 

bson (1.0.4, 1.0.3, 1.0.1, 1.0) 
bson_ext (1.0.4, 1.0.1, 1.0) 
mongo (1.0.4, 1.0.1, 1.0) 
mongoid (1.9.1) 
mongo_ext (0.19.3) 

而且,我嘗試過使用1.0和1.0.1,但是拋出了相同的異常。

怎麼了?

回答

2

試着改變你的config.gem行:

config.gem 'bson_ext', :version=>'1.0.4', :lib => false 

這可以防止鐵軌從試圖要求「bson_ext」,這是行不通的。 bson gem實際上會自動嘗試要求「bson_ext/cbson」,如果找不到本機版本,最終會回退到bson_ruby。

0

我不得不卸載所有BSON和蒙戈的寶石,然後用只運行rake gems:install:在我environment.rb文件

config.gem "mongo_mapper" 

。 Railscasts MongoDB and MongoMapper幫助我開始使用MongoDB和Rails 2.3.8應用程序。其他任何東西都會產生bson_ext錯誤。

+0

所以你運行沒有bson_ext庫? – 2010-07-16 00:15:08

+0

是的,這是正確的。我將嘗試在我的下一個實例中僅使用「config.gem」mongoid'「進行全新安裝,以確認這一點。 – rxgx 2010-07-19 19:38:44

相關問題