【问题标题】:Trouble installing Mongoid with Rails 3 on Windows在 Windows 上使用 Rails 3 安装 Mongoid 时遇到问题
【发布时间】:2011-12-21 19:59:48
【问题描述】:

在我的 Gemfile 中:

gem "mongoid", "~> 2.3"
gem "bson_ext", "~> 1.4"

当我运行 bundle install 时,我收到以下错误:

Bundler could not find compatible versions for gem "activemodel":
  In Gemfile:
    mongoid (~> 2.3) x86-mingw32 depends on
      activemodel (~> 3.1) x86-mingw32

    rails (= 3.0.6) x86-mingw32 depends on
      activemodel (3.0.6)

我已尝试将版本指向 github,正如其他一些帖子中所建议的那样,但是当我这样做并运行 bundle install 时,我收到另一个错误:

Fetching http://github.com/mongoid/mongoid.git
C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/source.rb:579:in
``': No such file or directory - git clone "http://github.com/mongoid/mongoid.gi
t" "C:/Ruby192/lib/ruby/gems/1.9.1/cache/bundler/git/mongoid-96bbbaf83f2d1e3487e
c2c95b9e5148015a7a346" --bare --no-hardlinks (Errno::ENOENT)
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/sour
ce.rb:579:in `git'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/sour
ce.rb:653:in `cache'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/sour
ce.rb:551:in `specs'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/defi
nition.rb:356:in `block in converge_locked_specs'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/defi
nition.rb:345:in `each'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/defi
nition.rb:345:in `converge_locked_specs'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/defi
nition.rb:143:in `resolve'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/defi
nition.rb:90:in `specs'

感谢任何提示。谢谢!

【问题讨论】:

    标签: ruby-on-rails-3 windows-7 mongoid


    【解决方案1】:

    如果我没记错的话,bson_ext 需要在本地构建。这意味着您必须以某种方式在 Windows 上构建它。错误指向x86-mingw32,可以从here下载

    您需要它的原因是因为有几个库依赖于平台。希望这能让您朝着正确的方向前进。

    【讨论】:

    • gems 本身似乎安装得很好,但如果我运行rails g mongoid:configbundle install,这两个命令都会产生上述错误。鉴于这一点信息,您是否仍然认为构建/安装 gems 存在问题,或者您认为安装x86-mingw32 可以解决问题?感谢您的回复。
    • 我还是会安装 x86-mingw32。顺便说一句,您安装了 MongoDB 吗?不是 gem,而是实际的数据库。
    • 可以,但您链接的页面目前似乎已损坏。我会在别处寻找它,但如果我碰巧接受你的回答,你可能想更新你的回复:)
    • 我尝试安装 x86-mingw32,并在我的Path 环境变量中添加了其bin 文件夹的路径,但我仍然遇到同样的错误。您确定错误指向 x86-mingw32 吗?该错误在我看来是 ActiveModel 问题,但 gem list 显示 activemodel (3.1.3, 3.0.6)
    猜你喜欢
    • 2012-07-29
    • 2014-06-28
    • 2015-04-01
    • 2012-09-19
    • 1970-01-01
    • 1970-01-01
    • 2015-01-17
    • 2017-01-15
    相关资源
    最近更新 更多