开发者

gem not available, even after adding to gemfile and running bundle install

开发者 https://www.devze.com 2023-04-11 19:53 出处:网络
I\'m making a simple task where I need to parse an XML Http response, all开发者_运维问答 the http is working fine, and I have my xml string....

I'm making a simple task where I need to parse an XML Http response, all开发者_运维问答 the http is working fine, and I have my xml string....

I'm trying to use the xml-simple gem.

I've gem install xml-simple

I've also added gem 'xml-simple' to the gemfile

Ran bundle install with success

but when I try to require 'xml-simple' in my rake task it fails saying no such file to load -- xml-simple...

What am I missing???


Bundler tries to load the gem by using the gem name as the require path (i.e. require 'xml-simple'). But in the case of the xml-simple gem, the path is xmlsimple, not xml-simple.

So in your Gemfile, use this instead:

gem 'xml-simple', :require => 'xmlsimple'


Gems sometimes have a different require path than the gem name, try either:

gem 'xml-simple', :require => 'xml/simple'

or

gem 'xml-simple', :require => 'xmlsimple'

or whatever the correct require path is to specify

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号