gpt4 book ai didi

ruby - 安装 ruby​​ gem nokogiri 时缺少 libxslt

转载 作者:数据小太阳 更新时间:2023-10-29 06:38:18 26 4
gpt4 key购买 nike

我知道这是一个重复的问题,但是我发现与此问题相关的所有其他答案似乎都没有帮助我...

我正在安装 GitLab 并在它满足 NokoGiri gem 要求时运行 gem 依赖项并失败并显示以下信息:

ERROR:  Error installing nokogiri:
ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb
extconf.rb:10:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
extconf.rb:10:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
extconf.rb:11:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... yes
checking for xmlParseDoc()... -lxml2
checking for xsltParseStylesheetDoc()... -lxslt
-----
libxslt is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----

所以,这个错误让我尝试使用以下命令安装 libxslt:

$ sudo apt-get install libxslt-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libxslt1-dev' instead of 'libxslt-dev'
libxslt1-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 146 not upgraded.

那么是什么给了? NokoGiri 需要这个包,但是这个包已经安装了!!我似乎无法解决这个问题,有什么帮助吗?

最佳答案

首先确保您拥有所有依赖项,如“Installing Nokogiri with RVM on Ubuntu”中所述(其中提到了完全相同的错误消息)

I have no idea why it can't find the package "libxslt". Instead of worrying about that, I'm going to install the dependencies listed on Nokogiri GitHub page:

$ sudo apt-get install libxslt-dev libxml2-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libxslt1-dev' instead of 'libxslt-dev'
libxslt1-dev is already the newest version.
libxml2-dev is already the newest version.

That appears to have worked well enough, so I press on. The next step is install the actual Nokogiri gem. The instructions say to use "sudo gem install nokogiri", but because I'm using RVM, I drop the "sudo" part:

$ gem install nokogiri

考虑到“Fresh install of RVM in Ubuntu isn't letting me install gems (zlib error)”,因为您有 libxslt1-dev(而不是 libxslt-dev),您可能会考虑重新编译您的 ruby​​。
(有点像“How to get Readline support in IRB using RVM on Ubuntu 11.10”)

关于ruby - 安装 ruby​​ gem nokogiri 时缺少 libxslt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16084144/

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