简体   繁体   中英

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

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 (ie 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM