gpt4 book ai didi

ruby - 无法在 Ruby 版本高于要求的 CentOS 上安装 Nokogiri

转载 作者:数据小太阳 更新时间:2023-10-29 07:28:33 25 4
gpt4 key购买 nike

以下是我在 CentOS6.5 服务器上的尝试。我已经更新了 Git 和 Ruby,但仍然无法安装。第一部分是我尝试以 sudo 用户身份安装它的地方。第二部分是我尝试以 root 方式安装它的时候。

任何人都可以提供有关如何解决此问题的其他想法吗?我很难找到解决此问题的方法。

第 1 部分:

[user@server gitlab-rails]$ sudo gem install nokogiri -- --use-system-libraries
[sudo] password for user:
Fetching: mini_portile-0.6.2.gem (100%)
Successfully installed mini_portile-0.6.2
Fetching: nokogiri-1.6.6.2.gem (100%)
ERROR: Error installing nokogiri:
nokogiri requires Ruby version >= 1.9.2.
[user@server gitlab-rails]$ ruby --version
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]

第 2 部分:

[root@server gitlab-rails]# gem install nokogiri -- --use-system-libraries
Building native extensions with: '--use-system-libraries'
This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb --use-system-libraries
checking if the C compiler accepts ... yes
Building nokogiri using system libraries.
libxml2 version 2.6.21 or later is required!
*** 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=/usr/local/bin/ruby
--help
--clean
--use-system-libraries
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--with-xml2-dir
--without-xml2-dir
--with-xml2-include
--without-xml2-include=${xml2-dir}/include
--with-xml2-lib
--without-xml2-lib=${xml2-dir}/lib
--with-libxml-2.0-config
--without-libxml-2.0-config
--with-pkg-config
--without-pkg-config
--with-xslt-dir
--without-xslt-dir
--with-xslt-include
--without-xslt-include=${xslt-dir}/include
--with-xslt-lib
--without-xslt-lib=${xslt-dir}/lib
--with-libxslt-config
--without-libxslt-config
--with-exslt-dir
--without-exslt-dir
--with-exslt-include
--without-exslt-include=${exslt-dir}/include
--with-exslt-lib
--without-exslt-lib=${exslt-dir}/lib
--with-libexslt-config
--without-libexslt-config

extconf failed, exit code 1

Gem files will remain installed in /usr/local/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0-static/nokogiri-1.6.6.2/gem_make.out

最佳答案

yum install libxslt-devel libxml2-devel
bundle config build.nokogiri --use-system-libraries
bundle install

关于ruby - 无法在 Ruby 版本高于要求的 CentOS 上安装 Nokogiri,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28417454/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com