MongoMapper 和 bson_ext 问题

发布于 2024-09-02 09:04:43 字数 396 浏览 9 评论 0原文

我无法让 MongoMapper 与我的 Rails 应用程序一起使用。我收到此错误消息:

**注意:C 扩展未加载。这是最佳 MongoDB Ruby 驱动程序性能所必需的。 您可以按如下方式安装扩展: gem install bson_ext

如果安装后继续收到此消息,请确保 bson_ext gem 在您的加载路径中,并且 bson_ext 和 mongo gem 具有相同版本。

我已经安装了 DevKit 并安装了 gem: gem install bson_ext --no-rdoc --no-ri (结果:安装了 bson_ext-1.0.1)

我在 Windows 7 上运行。Rails 版本是 2.3.7。我在安装时使用了RubyInstaller。有人能指出我正确的方向吗?

I can't get MongoMapper to work with my Rails app. I get this error message:

**Notice: C extension not loaded. This is required for optimum MongoDB Ruby driver performance.
You can install the extension as follows:
gem install bson_ext

If you continue to receive this message after installing, make sure that the
bson_ext gem is in your load path and that the bson_ext and mongo gems are of the same version.

I have installed DevKit and installed the gem: gem install bson_ext --no-rdoc --no-ri (result: bson_ext-1.0.1 installed)

I'm running on Windows 7. The Rails version is 2.3.7. I used the RubyInstaller when installing. Can anyone point me in the right direction?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

荒芜了季节 2024-09-09 09:04:43

问题是:bson_ext gem 版本和 mongo gem 版本需要匹配,而且 mongo_mapper 还没有准备好 mongo-1.0.1,因此您应该使用的 mongo 和 bson_ext gem 版本均为 1.0,分别。

因此,请执行以下操作:

gem install mongo -v=1.0 --no-ri --no-rdoc && \
gem install bson_ext -v=1.0 --no-ri --no-rdoc

然后,对于 Rails 2.x,在 config/environment.rb 中执行:

config.gem 'mongo', :version => '1.0'
config.gem 'bson_ext', :version => '1.0'

或对于 Rails 3,在 Gemfile 中执行:

gem 'mongo', '1.0'
gem 'bson_ext', '1.0'

The problem is: the bson_ext gem version and the mongo gem version need to match, also, mongo_mapper isn't ready for mongo-1.0.1 yet, so the versions of the mongo and bson_ext gems you should be using are 1.0 for each, respectively.

so, do the following:

gem install mongo -v=1.0 --no-ri --no-rdoc && \
gem install bson_ext -v=1.0 --no-ri --no-rdoc

then for Rails 2.x in your config/environment.rb do:

config.gem 'mongo', :version => '1.0'
config.gem 'bson_ext', :version => '1.0'

or for Rails 3, in your Gemfile:

gem 'mongo', '1.0'
gem 'bson_ext', '1.0'
南街九尾狐 2024-09-09 09:04:43

这一般是由于安装的bson_ext版本不等于MongoMapper所需的版本号导致的。检查需要哪个版本的 bson MongoMapper,然后确保您拥有该版本且没有安装其他版本。

This is generally caused by installing a version of bson_ext not equal to the version number required by MongoMapper. Check which version of bson MongoMapper is requiring, and then make sure that you have that version and no other installed.

左秋 2024-09-09 09:04:43

我需要指定 bson 版本才能使其正常工作,如下所示:(

gem 'mongo', "1.1"
gem 'bson', "1.1"
gem 'bson_ext', "1.1"

使用 Rails 3)

I needed specify the bson version to get this to work, like so:

gem 'mongo', "1.1"
gem 'bson', "1.1"
gem 'bson_ext', "1.1"

(Using rails 3)

寄意 2024-09-09 09:04:43

我按照上面的说明进行操作,但仍然是“没有这样的文件来加载‘bson_ext’”。我转到 gem 并尝试将“ext”文件夹中的文件夹向上移动一级(到 gem 的根目录),瞧,它起作用了。

I followed the instructions above but still the "no such file to load 'bson_ext'. I went to the gem and tried moving the folders in the "ext" folder up one level (to the root of the gem) and lo and behold, it worked. FWIW...

比忠 2024-09-09 09:04:43

在您的环境中包含以下内容.rb

config.gem 'bson_ext', :version => "1.0", :lib => "bson_ext/cbson"

Include the following in your environment.rb

config.gem 'bson_ext', :version => "1.0", :lib => "bson_ext/cbson"
本宫微胖 2024-09-09 09:04:43
  1. 安装bson_ext使用:

    gem install bson_ext
    
  2. 将 gem 添加到您的 Gemfile

    gem 'bson_ext'
    
  3. 在项目根级别目录中运行 bundle

  1. Install bson_ext using:

    gem install bson_ext
    
  2. Add the gem to your Gemfile:

    gem 'bson_ext'
    
  3. Run bundle in your project root level directory.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文