Trouble installing Mongoid with Rails 3 on Windows

2019-08-01 07:43发布

In my Gemfile:

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

When I run bundle install I get the error below:

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)

I've tried pointing to github for the version, as is suggested in some other posts, but when I do this and run bundle install, I get another error:

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'

Any tips are appreciated. Thanks!

1条回答
做自己的国王
2楼-- · 2019-08-01 08:13

If I recall correctly, bson_ext needs to be built natively. This means that somehow you must build it on Windows. The errors are pointing to x86-mingw32, which can be downloaded from here

The reason you would need that is because there are a couple of libraries that are platform dependent. Hope this sets you in the right direction.

查看更多
登录 后发表回答