2011-11-04 52 views
36

安装引入nokogiri 1.5.0以下是错误捆绑运行在服务器上安装供应商/宝石:错误与导轨3.1.0和Ubuntu

Installing nokogiri (1.5.0) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 

     /home/dtt/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb 
checking for libxml/parser.h... no 
----- 
libxml2 is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies. 
----- 
*** 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 
     --without-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=/home/dtt/.rvm/rubies/ruby-1.9.2-p290/bin/ruby 
     --with-zlib-dir 
     --without-zlib-dir 
     --with-zlib-include 
     --without-zlib-include=${zlib-dir}/include 
     --with-zlib-lib 
     --without-zlib-lib=${zlib-dir}/lib 
     --with-iconv-dir 
     --without-iconv-dir 
     --with-iconv-include 
     --without-iconv-include=${iconv-dir}/include 
     --with-iconv-lib 
     --without-iconv-lib=${iconv-dir}/lib 
     --with-xml2-dir 
     --without-xml2-dir 
     --with-xml2-include 
     --without-xml2-include=${xml2-dir}/include 
     --with-xml2-lib 
     --without-xml2-lib=${xml2-dir}/lib 
     --with-xslt-dir 
     --without-xslt-dir 
     --with-xslt-include 
     --without-xslt-include=${xslt-dir}/include 
     --with-xslt-lib 
     --without-xslt-lib=${xslt-dir}/lib 


Gem files will remain installed in /vol/www/emclab/releases/20111104001151/vendor/gems/ruby/1.9.1/gems/nokogiri-1.5.0 for inspection. 
Results logged to /vol/www/emclab/releases/20111104001151/vendor/gems/ruby/1.9.1/gems/nokogiri-1.5.0/ext/nokogiri/gem_make.out 
An error occured while installing nokogiri (1.5.0), and Bundler cannot continue. 
Make sure that `gem install nokogiri -v '1.5.0'` succeeds before bundling. 

您可以跳过这一部分。错误信息几乎是自我解释,但网站需要更多的单词来解释代码。

有什么想法?

+8

通过安装一个lib解决: rvmsudo的apt-get安装libxslt1-dev的 – user938363

+0

你救了我的感谢。 – RSK

+0

@ user938363:应该发布为答案并已接受 –

回答

61

您需要在机器上安装所有必需的库。当你安装RVM时,它应该已经为你列出了这个。在rvm的当前版本上,您可以运行rvm requirements以查看确切的列表。现在,该名单是:

sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion

25

你缺少一些软件包。尝试运行这个(仅限Linux):

$ sudo apt-get install libxslt-dev libxml2-dev 
+0

谢谢,它适用于debian。 – northtree

4

只是这样做:

sudo apt-get install libxslt-dev libxml2-dev libxml2 

然后在终端(Linux版)键入此/ CMD(窗口):

export NOKOGIRI_USE_SYSTEM_LIBRARIES=true 
+2

在Ubuntu上'export NOKOGIRI_USE_SYSTEM_LIBRARIES = true'为我工作。谢谢!我认为在安装nokogiri时,使用'--use-system-libraries'标志将会产生相同的效果。但是如果你在'Gemfile'上使用'bundle install',我想最好的办法是设置这个配置选项。 – basicallydan

0

试试这个如果别人不工作, 它真的对我有用。 Devtools for CentOS

+0

而不是张贴链接,总结该网页上的内容有帮助。链接腐烂,所以当这样做时,答案将是没有价值的。 –

0

当我用这个代码,我得到了另一个错误:

ERROR: Error installing disposable: 
    invalid gem: package is corrupt, exception while verifying: undefined method `size' for nil:NilClass (NoMethodError) in /home/admin/.rvm/gems/[email protected]/cache/nokogiri-1.6.4.1.gem 

我尝试了许多不同的解决方案,而是帮助MED:

$ rm /home/admin/.rvm/gems/[email protected]/cache/nokogiri-1.6.4.1.gem 
$ gem update 
$ gem install nokogiri 

其他命令,可以帮助:

sudo apt-get install synaptic 
sudo apt-get update 
sudo apt-get install qt4-dev-tools libqt4-dev libqt4-core libqt4-gui 
sudo apt-get install build-essential 
sudo apt-get install "^libxcb.*" libx11-xcb-dev libglu1-mesa-dev libxrender-dev 
5

它看起来像一个宝石依赖性错误。

您需要运行bundle update命令。这既解决了依赖关系:

bundle update