【问题标题】:Can't install Nokogiri 1.4.3 gem无法安装 Nokogiri 1.4.3 gem
【发布时间】:2015-05-19 10:23:34
【问题描述】:

无法安装 nokogiri 1.4.3 gem。 Nokogiri 1.6.6.2 安装没有问题。在 Ubuntu 上使用最新的 RVM。

pm@sniegas:~$ gem install nokogiri -v '1.4.3'
Fetching: nokogiri-1.4.3.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

    /home/pm/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150519-7580-2yzgsg.rb extconf.rb
*** 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/pm/.rvm/rubies/ruby-2.2.1/bin/$(RUBY_BASE_NAME)
extconf.rb:10:in `<main>': uninitialized constant Config (NameError)

extconf failed, exit code 1

Gem files will remain installed in /home/pm/.rvm/gems/ruby-2.2.1/gems/nokogiri-1.4.3 for inspection.
Results logged to /home/pm/.rvm/gems/ruby-2.2.1/extensions/x86_64-linux/2.2.0/nokogiri-1.4.3/gem_make.out

我应该从哪里开始寻找解决方案?

【问题讨论】:

  • stackoverflow.com/questions/8003523/… 尝试建议的解决方案
  • 安装了所有必需的库。
  • 尝试在 OS X 10.9.5 上使用 chruby 安装 1.4.7ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin13] 时出现同样的错误。

标签: ruby-on-rails ruby rubygems rvm nokogiri


【解决方案1】:

通过执行(接近)以下操作,我设法安装了1.4.7

git clone git@github.com:sparklemotion/nokogiri.git
cd nokogiri
gem install rake-compiler hoe racc rexical
git checkout v1.4.7 # 1.4.3 in your case
# edit ./ext/nokogiri/extconf.rb and replace `Config` with `RbConfig`
rake install_deps
rake install_gem

希望我没有忘记一步。

编辑: 从头开始​​,安装的 gem 不起作用。我暂时把它留在这里,以防它对某人有帮助。

编辑 (Jonas): 解决方案的提示在 bug report 中。我坚持使用 Ruby 2.1.5,它解决了这个问题。

【讨论】:

  • 向乔纳斯致敬!花了足够多的时间尝试使 nokogiri 1.5.0 与 ruby​​ 2.2.1 一起工作。切换到 2.1.5 并且可以正常工作。
  • 我不确定其他版本的 rake,但在 11.3.0 版本上需要执行 rake install:deps 而不是 rake install_deps
猜你喜欢
  • 2015-02-14
  • 2016-02-03
  • 2021-06-12
  • 2014-10-18
  • 2014-06-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多