ruby-on-rails - 在优胜美地安装 Nokogiri

标签 ruby-on-rails nokogiri homebrew osx-yosemite

这个问题在这里已经有了答案:





Failure to install nokogiri libiconv is missing on Yosemite Mac OS X 10.10

(10 个回答)


6年前关闭。




我正在尝试通过 Yosemite 上的 RVM 安装 Ruby on Rails。不过,一切似乎都奏效了,当我尝试运行“捆绑安装”时,出现了与 Nokogiri 相关的错误:

pauls-air:~ paulmcguane$ gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28 --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib
Building native extensions with: '--with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28 --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib'
This could take a while...
Building nokogiri using packaged libraries.
ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

错误信息是:
/Users/paulmcguane/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb
Building nokogiri using packaged libraries.
-----
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.

Provided configuration options:
        --with-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=/Users/paulmcguane/.rvm/rubies/ruby-2.1.2/bin/ruby
        --help
        --clean
        --use-system-libraries
        --enable-static
        --disable-static
        --with-zlib-dir
        --without-zlib-dir
        --with-zlib-include
        --without-zlib-include=${zlib-dir}/include
        --with-zlib-lib
        --without-zlib-lib=${zlib-dir}/lib
        --enable-cross-build
        --disable-cross-build

extconf failed, exit code 1

最佳答案

我刚刚完整安装了 Rails 和 Ruby 以及您需要的一切。我遵循了这些步骤。

https://gorails.com/setup/osx/10.10-yosemite

并使用以下命令安装 nokogiri

xcode-select --install
gem install nokogiri
bundle config build.nokogiri --use-system-libraries
bundle install

关于ruby-on-rails - 在优胜美地安装 Nokogiri,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24105669/

相关文章:

ruby-on-rails - 将渲染的 View 作为电子邮件发送

ruby - Nokogiri 只抓取可见的 inner_text

macos - 如何用一行运行多个 brew 命令?

ruby-on-rails - Rails Checkout SSL heroku

ruby-on-rails - Rails Controller 和实例变量

ruby-on-rails - E : Unable to locate package heroku-toolbelt

ruby - 如何仅搜索和更新某些文本,而忽略某些元素名称中的文本

ruby - Nokogiri 和随机 div 名称

python - Homebrew python 安装选项

macos - 安装 Homebrew 软件和 Laravel Valet 后,Sudo 出现错误