Rails Bundler on windows refuses to install hprico

2019-02-28 07:00发布

Upgraded to rails 3, and using Bundler for gems, in a mixed platform development group. I am on Windows. When I run Bundle Install it completes succesfully but will not install hpricot. The hpricot line is:

gem "hpricot", "0.8.3", :platform => :mswin

also tried

gem "hpricot", :platform => :mswin

Both complete fine but when I try to do a "bundle show hpricot" I get:

Could not find gem 'hpricot' in the current bundle.

If I do a run a rails console and try "require 'hpricot'" I get:

LoadError: no such file to load -- hpricot

I have manually installed hpricot as well, and still get the above error. This worked fine before moving to rails 3.

2条回答
爷、活的狠高调
2楼-- · 2019-02-28 07:11

Try this in console and then do bundle install, it will work:

gem install hpricot --platform=mswin32
查看更多
Juvenile、少年°
3楼-- · 2019-02-28 07:19

It may be that you are using a version of ruby that was built with MinGW in which case your platform will be 'mingw' rather than 'mswin'. Try changing your Gemfile line to the following:

gem "hpricot", "0.8.3", :platform => :mingw

And if you have other developers that are using the current setup and don't wan to break it for them, change it to this:

gem "hpricot", "0.8.3", :platforms => [:mswin, :mingw]
查看更多
登录 后发表回答