Çağ*_*daş 12 ruby ruby-on-rails nokogiri rvm-capistrano
在相继bundle:install
之后deploy:finalize_update
,我收到关于nokogiri的错误.它暗示,
** [out :: *******] Make sure that `gem install nokogiri -v '1.6.0'` succeeds before bundling.
Run Code Online (Sandbox Code Playgroud)
所以我试着在服务器上自己安装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
Run Code Online (Sandbox Code Playgroud)
它刚刚开始.还安装了libxml2.
任何的想法?
谢谢.
编辑:我不需要在我的gemfile中明确nokogiri.
小智 37
我与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
Run Code Online (Sandbox Code Playgroud)
作为一种解决方法(假设您安装了libxml2-dev和libxslt-dev),您可以:
NOKOGIRI_USE_SYSTEM_LIBRARIES=1 bundle install
Run Code Online (Sandbox Code Playgroud)
我希望它有所帮助.
Tia*_*ago 11
如果您使用的是Capistrano 3.x,则可以在deploy.rb
文件中执行以下操作(或特定于环境的文件deploy/production.rb
)
set :bundle_env_variables, { 'NOKOGIRI_USE_SYSTEM_LIBRARIES' => 1 }
Run Code Online (Sandbox Code Playgroud)
这样就可以避免覆盖bundle install
任务.这将env
在运行时设置给定的变量bundle install
.
归档时间: |
|
查看次数: |
4791 次 |
最近记录: |