【问题标题】:Nokogiri installation error for Ruby 1.8.7 for Linux OSRuby 1.8.7 for Linux OS 的 Nokogiri 安装错误
【发布时间】:2014-06-24 00:36:06
【问题描述】:

我正在 Linux 操作系统上使用 Rails 3.2.1 和 ruby​​ 1.8.7。 我正在尝试在 WHM 服务器上为 Authorize-net gem 安装 Nokogiri。我收到以下错误:

gem install nokogiri -v '1.5.0'

Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
        ERROR: Failed to build gem native extension.

        /usr/bin/ruby extconf.rb
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... no
-----
libxslt is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** 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.

mkmf.log 文件指出缺少 libxslt。

尝试安装 libxslt-ruby 时,我收到以下错误:

Building native extensions.  This could take a while...
ERROR:  Error installing libxslt-ruby:
        ERROR: Failed to build gem native extension.

        /usr/bin/ruby extconf.rb
checking for ruby/io.h... no
checking for inflate() in -lz... yes
checking for iconv_open() in -liconv... no
checking for libiconv_open() in -liconv... no
checking for libiconv_open() in -llibiconv... no
checking for iconv_open() in -llibiconv... no
checking for iconv_open() in -lc... yes
checking for xmlXPtrNewRange() in -lxml2... yes
checking for libxml/xmlversion.h... no
checking for libxml/xmlversion.h in /opt/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... yes
checking for xsltApplyStylesheet() in -lxslt... no
checking for xsltApplyStylesheet() in -llibxslt... no
checking for xsltApplyStylesheet() in -lxslt... no
*** 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.

mkmf.log 文件指出:

have_header: checking for ruby/io.h... -------------------- no

"gcc -E -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -I/usr/local/include    -O2 -g -m64 -mtune=generic -Wall -fno-strict-aliasing  -fPIC    conftest.c -o conftest.i"
conftest.c:1:21: error: ruby/io.h: No such file or directory
checked program was:
/* begin */
1: #include <ruby/io.h>
/* end */

我在 Windows 机器上开发,但客户端的服务器是 Linux。我试过谷歌搜索,但没有运气。

任何帮助将不胜感激!

提前致谢!

【问题讨论】:

标签: ruby-on-rails nokogiri authorize.net whm libxslt


【解决方案1】:

我认为“缺少 libxslt”并不意味着您必须安装 gem libxslt-ruby。它告诉你安装 package libxslt-dev.

只需关注http://nokogiri.org/tutorials/installing_nokogiri.html 并运行:

sudo apt-get install libxslt-dev libxml2-dev
sudo gem install nokogiri

【讨论】:

  • 我试过上面的代码,但它说:sudo apt-get install libxslt-dev libxml2-dev -bash: sudo: command not found.
  • @user3445812 那你有root权限吗?
  • WHM 服务器的cpanel 显示此通知:“警告!您使用经销商或root 密码登录。”但我仍然收到“sudo not found”消息。
  • @user3445812 您以 root 身份登录。所以你不需要sudo。但是,以 root 身份登录并不是一个好主意。
  • 链接页面(在撰写本文时)不建议使用 sudo 运行“gem install”。我也不推荐。
猜你喜欢
  • 2015-08-27
  • 2013-05-05
  • 2023-04-09
  • 1970-01-01
  • 1970-01-01
  • 2013-03-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多