deploy无法安装nokogiri

deploy无法安装nokogiri

本文介绍了capistrano deploy无法安装nokogiri的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 cap生产部署在Ubuntu 12.04机器上的nokogiri安装上失败:

My cap production deploy is failing on nokogiri installation on an Ubuntu 12.04 box:

DEBUG [6f355ce8]    Extracting libxml2-2.8.0.tar.gz into tmp//ports/libxml2/2.8.0... OK
DEBUG [6f355ce8]    Running 'configure' for libxml2 2.8.0... ERROR, review 'tmp//ports/libxml2/2.8.0/configure.log' to see what happened.
DEBUG [6f355ce8]    *** extconf.rb failed ***
DEBUG [6f355ce8]    Make sure that `gem install nokogiri -v '1.6.1'` succeeds before bundling.

我检查了上述日志,并提到没有找到C编译器。我试图在nokogiri网站上安装ubuntu的依赖项,系统说它们已经安装。

I checked said logs and it mentions not finding a C compiler. I tried to install the dependencies for ubuntu on the nokogiri site and the system says they are already installed.

我还尝试了 gem在服务器上安装nokogiri -v'1.6.1'并成功完成,没有任何问题,宝石列表显示它已安装在服务器上。

I also tried gem install nokogiri -v '1.6.1' on the server and it succeeds with no issues, gem list shows it installed on the server.

我发现了一个类似的问题,建议将此行添加到production.rb

I found a similar question that suggested adding this line to the production.rb

set:bundle_env_variables,{'NOKOGIRI_USE_SYSTEM_LIBRARIES'=> 1}

将错误更改为更具体:

DEBUG [1e93b004]    /usr/local/rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:430:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
DEBUG [1e93b004]    You have to install development tools first.

但是尝试通过以下方式安装它们:

But trying to install them via:

sudo apt-get install libxslt-dev libxml2-dev

表示所有内容均已安装-再次, nokogiri在 deploy 任务之外可以很好地安装。

says everything is already installed --and again, nokogiri installs fine outside of the deploy task.

推荐答案

我不见了Ubuntu的ruby开发依赖项之一: http://nokogiri.org/tutorials/installing_nokogiri.html

I was missing one of the ruby dev dependencies for ubuntu: http://nokogiri.org/tutorials/installing_nokogiri.html

另外,由于某种原因,该服务器仅授予 root 权限来访问某些nokogiri依赖项,我不得不 chmod 给我的部署用户。

Also, for some reason this server only gave root permissions to access some of the nokogiri dependencies, I had to chmod them for my deploy user.

这篇关于capistrano deploy无法安装nokogiri的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 10:31