在 ubuntu 服务器上部署 capistrano 时出现关于 nokogiri 的错误 [英] Error about nokogiri while capistrano deployment on ubuntu server

查看:33
本文介绍了在 ubuntu 服务器上部署 capistrano 时出现关于 nokogiri 的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

deploy:finalize_update 之后的 bundle:install 阶段,我收到关于 nokogiri 的错误.它表明,

While bundle:install phase after deploy:finalize_update,i'm getting an error about nokogiri. It suggests ,

 ** [out :: *******] Make sure that `gem install nokogiri -v '1.6.0'` succeeds before bundling.

所以我尝试在服务器上自己安装 nokogiri.但它出现以下错误,

So i tried to install nokogiri by myself on server.But it gives following error,

Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

    /home/deployer/.rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb
Extracting libxml2-2.8.0.tar.gz into tmp/x86_64-linux-gnu/ports/libxml2/2.8.0... OK
Running 'configure' for libxml2 2.8.0... OK
Running 'compile' for libxml2 2.8.0... ERROR, review 'tmp/x86_64-linux-gnu/ports/libxml2/2.8.0/compile.log' to see what happened.
*** 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/deployer/.rvm/rubies/ruby-2.0.0-p0/bin/ruby
/home/deployer/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/gems/2.0.0/gems/mini_portile-0.5.0/lib/mini_portile.rb:235:in `block in execute': Failed to complete compile task (RuntimeError)
    from /home/deployer/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/gems/2.0.0/gems/mini_portile-0.5.0/lib/mini_portile.rb:227:in `chdir'
    from /home/deployer/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/gems/2.0.0/gems/mini_portile-0.5.0/lib/mini_portile.rb:227:in `execute'
    from /home/deployer/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/gems/2.0.0/gems/mini_portile-0.5.0/lib/mini_portile.rb:61:in `compile'
    from /home/deployer/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/gems/2.0.0/gems/mini_portile-0.5.0/lib/mini_portile.rb:101:in `cook'
    from extconf.rb:101:in `block in <main>'
    from extconf.rb:119:in `call'
    from extconf.rb:119:in `block in <main>'
    from extconf.rb:109:in `tap'
    from extconf.rb:109:in `<main>'


Gem files will remain installed in /home/deployer/.rvm/gems/ruby-2.0.0-p0/gems/nokogiri-1.6.0 for inspection.
Results logged to /home/deployer/.rvm/gems/ruby-2.0.0-p0/gems/nokogiri-1.6.0/ext/nokogiri/gem_make.out

今天刚开始,libxml2也已经安装了.

It just started today.Also libxml2 is already installed.

有什么想法吗?

谢谢.

我的 gemfile 中没有明确要求 nokogiri.

I dont require explicitly nokogiri in my gemfile.

推荐答案

我在使用 Nokogiri 1.6.0 时遇到了同样的问题.从日志中可以看出,问题是由 libxml2 编译失败引起的,libxml2 与 libxslt 一起被嵌入到 gem 中并在安装时编译.

I faced the same issue with Nokogiri 1.6.0. The problem, as you can see from the logs, it's caused by a failed compilation of libxml2 that, together with libxslt, is now shipped embedded in the gem and compiled when you install it.

要了解编译究竟出了什么问题,请查看建议的文件 compile.log,在您的情况下,您可以在以下位置找到该文件:

To find out what exactly went wrong with the compilation, have a look at the suggested file compile.log that, in your case, you can find at:

/home/deployer/.rvm/gems/ruby-2.0.0-p0/gems/nokogiri-1.6.0/ext/nokogiri/tmp/x86_64-linux-gnu/ports/libxml2/2.8.0/compile.log

作为一种解决方法(假设您安装了 libxml2-dev 和 libxslt-dev),您可以这样做:

As a workaround (assuming you have libxml2-dev and libxslt-dev installed), you can do:

NOKOGIRI_USE_SYSTEM_LIBRARIES=1 bundle install

希望能帮到你.

这篇关于在 ubuntu 服务器上部署 capistrano 时出现关于 nokogiri 的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆