在 ruby​​-1.8.7-p334 [ x86_64 ] 上使用 rvm 安装 nokogiri gem 时出错

发布于 2024-12-01 18:48:07 字数 1022 浏览 0 评论 0原文

当我尝试在 Mac OS X 10.6 上的 ruby-1.8.7-p334 [ x86_64 ] 上安装 nokogiri gem 时,出现以下错误:

sudo gem install nokogiri
/Users/patelc75/.rvm/rubies/ruby-1.8.7-p334/bin/gem:4: warning: Insecure world writable dir /Users in PATH, mode 040777
Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
ERROR: Failed to build gem native extension.

/Users/patelc75/.rvm/rubies/ruby-1.8.7-p334/bin/ruby extconf.rb
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... no
checking for iconv_open() in -liconv... no
-----
libiconv 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.

When I try to install nokogiri gem on ruby-1.8.7-p334 [ x86_64 ] on Mac OS X 10.6, I get the following error:

sudo gem install nokogiri
/Users/patelc75/.rvm/rubies/ruby-1.8.7-p334/bin/gem:4: warning: Insecure world writable dir /Users in PATH, mode 040777
Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
ERROR: Failed to build gem native extension.

/Users/patelc75/.rvm/rubies/ruby-1.8.7-p334/bin/ruby extconf.rb
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... no
checking for iconv_open() in -liconv... no
-----
libiconv 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

永不分离 2024-12-08 18:48:07

在安装 nokogiri gem 之前,您需要安装库。
执行此操作的步骤

# the rest of this snippet assumes installation of libxml 2.7.7. YMMV.
brew install libxml2
brew link libxml2

# install libxslt from source
wget ftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz
tar -zxvf libxslt-1.1.26.tar.gz
cd libxslt-1.1.26
./configure --prefix=/usr/local/Cellar/libxslt/1.1.26 \
            --with-libxml-prefix=/usr/local/Cellar/libxml2/2.7.7
make
sudo make install

gem install nokogiri -- --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26

以下是使用自制程序和 macports

sudo port install libxml2 libxslt
sudo gem install nokogiri

更多信息请参见http://nokogiri.org/tutorials/installing_nokogiri .html

Before installing nokogiri gem, you need to get libraries installed.
Here are the steps to do it with homebrew

# the rest of this snippet assumes installation of libxml 2.7.7. YMMV.
brew install libxml2
brew link libxml2

# install libxslt from source
wget ftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz
tar -zxvf libxslt-1.1.26.tar.gz
cd libxslt-1.1.26
./configure --prefix=/usr/local/Cellar/libxslt/1.1.26 \
            --with-libxml-prefix=/usr/local/Cellar/libxml2/2.7.7
make
sudo make install

gem install nokogiri -- --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26

With macports

sudo port install libxml2 libxslt
sudo gem install nokogiri

More information here http://nokogiri.org/tutorials/installing_nokogiri.html

讽刺将军 2024-12-08 18:48:07

我尝试了我能找到的各种解决方案,包括:
。使用brew安装libxslt / libxml2 / libiconv
。尝试使用各种 --with-configurations 进行 gem 安装
遗憾的是,它们都不适用于我,直到我卸载了 MacPort 和所有已安装的端口。

然后只需执行命令 gem install nokogiri,gem 和 rdoc 就轻松安装了。

我不明白为什么的细节,但根据我自己使用MacPort的经验(导致安装了多套ruby/rake/gem)以及比较brew和port的文章,我不会再回到port 。

I tries all kinds of solutions I can found, including:
. use brew to install libxslt / libxml2 / libiconv
. tries to gem install with various --with-configurations
sadly, they all didn't work for me, until I uninstalled MacPort and all installed ports.

Then simply executed command gem install nokogiri, the gem and rdoc got installed like a breeze.

I don't understand the very details of why, but according to my own experiences of using MacPort (resulted in multiple sets of ruby/rake/gem(s) installed) and articles comparing brew and port, I will not go back to port.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文