[英]gem not available, even after adding to gemfile and running bundle install
我正在做一個簡單的任務,我需要解析一個XML Http響應,所有的http工作正常,我有我的xml字符串....
我正在嘗試使用xml-simple
gem。
我有gem install xml-simple
我還在gemfile中添加了gem'xml gem 'xml-simple'
Ran bundle install
成功
但是當我嘗試在我的rake任務中require 'xml-simple'
,它無法說no such file to load -- xml-simple
...
我錯過了什么?
Bundler嘗試使用gem名稱作為require路徑加載gem(即require 'xml-simple'
)。 但是在xml-simple
gem的情況下,路徑是xmlsimple
,而不是xml-simple
。
所以在你的Gemfile中,請改用:
gem 'xml-simple', :require => 'xmlsimple'
寶石有時會有一個不同於寶石名稱的需求路徑,請嘗試:
gem 'xml-simple', :require => 'xml/simple'
要么
gem 'xml-simple', :require => 'xmlsimple'
或者指定正確的require路徑
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.