gpt4 book ai didi

ruby-on-rails - MongoId 和 bson_ext 问题 : no such file to load -- bson_ext

转载 作者:可可西里 更新时间:2023-11-01 10:35:54 24 4
gpt4 key购买 nike

关于 '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,但抛出了相同的异常。

怎么了?

最佳答案

尝试将您的 config.gem 行更改为:

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

这可以防止 rails 尝试要求“bson_ext”,这是行不通的。 bson gem 实际上会尝试自动要求“bson_ext/cbson”,如果找不到 native 版本,最终会回退到 bson_ruby。

关于ruby-on-rails - MongoId 和 bson_ext 问题 : no such file to load -- bson_ext,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3254529/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com