Nokogiri依赖libxml和libxslt没有安装

 丿至尊丨紫风 发布于 2022-12-23 15:40

我在Ubuntu 12.10 64bit上使用Ruby 2.1.我无法安装Nokogiri因为它需要libXSLT和libxml.我试图安装这两个,但得到了这个错误:

***@***:~$ sudo apt-get install libxslt-dev libxml2-dev
[sudo] password for : 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libxslt1-dev' instead of 'libxslt-dev'
libxml2-dev is already the newest version.
The following NEW packages will be installed:
  libxslt1-dev
0 upgraded, 1 newly installed, 0 to remove and 5 not upgraded.
Need to get 578 kB of archives.
After this operation, 2,422 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
WARNING: **The following packages cannot be authenticated!**
  libxslt1-dev
Install these packages without verification [y/N]? y
Err http://security.ubuntu.com/ubuntu/ quantal-security/main libxslt1-dev amd64 1.1.26-14ubuntu0.1
  404  Not Found [IP: 91.189.91.13 80]
Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/libx/libxslt/libxslt1-dev_1.1.26-14ubuntu0.1_amd64.deb  404  Not Found [IP: 91.189.91.13 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing

我试图添加12.04的安全更新,但仍有机会也没有命中.

我跑了sudo apt-get update,但问题仍然存在.

当我运行bundle install或时gem install nokogiri,我收到以下错误:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

  /home/####/.rvm/rubies/ruby-2.1.0/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.

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/kamal/.rvm/rubies/ruby-2.1.0/bin/ruby
  --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-iconv-dir
  --without-iconv-dir
  --with-iconv-include
  --without-iconv-include=${iconv-dir}/include
  --with-iconv-lib
  --without-iconv-lib=${iconv-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-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-pkg-config
  --without-pkg-config
  --with-libxml-2.0-config
  --without-libxml-2.0-config
  --with-libiconv-config
  --without-libiconv-config

extconf failed, exit code 1

Gem files will remain installed in /home/kamal/.rvm/gems/ruby-2.1.0@xxx/gems/nokogiri-1.5.11 for inspection.
Results logged to /home/****/.rvm/gems/ruby-2.1.0@project-trave/extensions/x86_64-linux/2.1.0/nokogiri-1.5.11/gem_make.out
An error occurred while installing nokogiri (1.5.11), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.5.11'` succeeds before bundling.

Gagan Gami.. 9

试试这个:

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

您需要在计算机上安装所有必需的库.安装RVM时,应该已经为您列出了这个.在当前版本的rvm上,您可以运行rvm requirements以查看完整列表.我希望这可以帮助你..

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有