Rails Bundler on windows refuses to install hpricot (even on manual gem install get Error: no such file to load — hpricot)

删除回忆录丶 提交于 2019-12-02 09:26:41

问题


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.


回答1:


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

gem install hpricot --platform=mswin32



回答2:


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]


来源:https://stackoverflow.com/questions/4159189/rails-bundler-on-windows-refuses-to-install-hpricot-even-on-manual-gem-install

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