Trouble installing Mongoid with Rails 3 on Windows

自古美人都是妖i 提交于 2019-12-11 05:26:48

问题


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:


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.



来源:https://stackoverflow.com/questions/8595558/trouble-installing-mongoid-with-rails-3-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!