capistrano deploy can't install nokogiri

╄→гoц情女王★ 提交于 2020-02-25 07:44:32

问题


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.

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.

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.

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

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

Which changes the error to be a bit more specific:

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

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


回答1:


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

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.



来源:https://stackoverflow.com/questions/23041232/capistrano-deploy-cant-install-nokogiri

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!