5
在嘗試在普通腳本和rails應用程序中安裝斜紋寶石寶石數小時後,我已經找到了專業人士。不能安裝Twilio gem - libxml問題
我得到的錯誤是「在Gemfile中: twilio,紅寶石被解析爲5.2.0,這取決於 的libxml-紅寶石 」
我嘗試安裝的libxml的寶石到我的寶石文件和錯誤「Gem :: Ext :: BuildError:錯誤:無法構建gem本機擴展」。然後在底部說:「安裝libxml-ruby(3.0.0)時發生錯誤,並且Bundler無法繼續。 請確保gem install libxml-ruby -v '3.0.0'
在綁定之前成功。」
我使用的rails版本是4.2.4,我的操作系統是MACOS Sierra。下面是我嘗試用twilio gem捆綁安裝時的整個輸出。我讀了幾篇關於Stack的文章,但目前爲止沒有任何幫助:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/jameshart/.rvm/gems/ruby-2.3.0/gems/libxml-ruby-3.0.0/ext/libxml
/Users/jameshart/.rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20170829-79771-thonjl.rb extconf.rb
checking for libxml/xmlversion.h in
/opt/include/libxml2,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/jameshart/.rvm/rubies/ruby-2.3.0/bin/$(RUBY_BASE_NAME)
--with-xml2-config
--without-xml2-config
--with-xml2-dir
--without-xml2-dir
--with-xml2-include
--without-xml2-include=${xml2-dir}/include
--with-xml2-lib
--without-xml2-lib=${xml2-dir}/lib
extconf failure: need libxml2.
Install the library or try one of the following options to extconf.rb:
--with-xml2-config=/path/to/xml2-config
--with-xml2-dir=/path/to/libxml2
--with-xml2-lib=/path/to/libxml2/lib
--with-xml2-include=/path/to/libxml2/include
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/jameshart/.rvm/gems/ruby-2.3.0/extensions/x86_64-darwin-16/2.3.0/libxml-ruby-3.0.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/jameshart/.rvm/gems/ruby-2.3.0/gems/libxml-ruby-3.0.0 for inspection.
Results logged to /Users/jameshart/.rvm/gems/ruby-2.3.0/extensions/x86_64-darwin-16/2.3.0/libxml-ruby-3.0.0/gem_make.out
An error occurred while installing libxml-ruby (3.0.0), and Bundler cannot continue.
Make sure that `gem install libxml-ruby -v '3.0.0'` succeeds before bundling.
In Gemfile:
twilio-ruby was resolved to 5.2.0, which depends on
libxml-ruby
我有Mac系統Sierra和之前沒有安裝Twilio寶石。我做了'gem list',可以看到我安裝了'libxml-ruby(2.6.0)'。我運行'sudo gem install twilio-ruby',它安裝了Twilio 5.2.0 gem ok。我的主文件夾中沒有'.rvm'目錄。我想知道你是否可以嘗試刪除該版本並回到「本地」版本?對不起,這不是太大的幫助! – Andy
我最終安裝了4.11版本,一切都很簡單。謝謝。你是男人 –
[libxml-ruby:無法構建gem原生擴展名](https://stackoverflow.com/questions/38129330/libxml-ruby-failed-to-build-gem-native-extension) – philnash