ruby-on-rails – 在ubuntu服务器上部署capistrano时,关于nokogiri的错误

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 在ubuntu服务器上部署capistrano时,关于nokogiri的错误前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
虽然bundle:部署后安装阶段:finalize_update,我收到有关nokogiri的错误.它表明,
** [out :: *******] Make sure that `gem install nokogiri -v '1.6.0'` succeeds before bundling.

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

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已经安装.

任何想法?

谢谢.

编辑:我不需要明确的nokogiri在我的宝石文件.

解决方法

我在Nokogiri 1.6.0中遇到了同样的问题.从日志中可以看出,问题是由于libxml2的编译失败而导致的,它与libxslt一起现在已经嵌入到gem中并在安装时被编译.

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

/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),您可以执行以下操作:

NOKOGIRI_USE_SYSTEM_LIBRARIES=1 bundle install

我希望它有帮助.

原文链接:https://www.f2er.com/ruby/272037.html

猜你在找的Ruby相关文章