【问题标题】:Error installing Nokogiri via Bundler on Windows在 Windows 上通过 Bundler 安装 Nokogiri 时出错
【发布时间】:2015-08-26 21:55:28
【问题描述】:

我正在尝试在我的 Windows 机器上设置和运行 Extreme Startup 编码道场。

当我到达bundle install 步骤时,我收到以下错误消息:

$ bundle install
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/..
Resolving dependencies...
Installing builder 3.2.2
Installing nokogiri 1.4.5 with native extensions

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

    c:/Ruby22-x64/bin/ruby.exe -r ./siteconf20150826-3512-ilnke5.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=c:/Ruby22-x64/bin/$(RUBY_BASE_NAME)
extconf.rb:10:in `<main>': uninitialized constant Config (NameError)

extconf failed, exit code 1

Gem files will remain installed in c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/nokogiri-1.4.5 for inspection.
Results logged to c:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/nokogiri-1.4.5/gem_make.out
An error occurred while installing nokogiri (1.4.5), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.4.5'` succeeds before bundling.

根据documentation for Nokogiri,它应该可以工作,从某种意义上说,它确实可以,因为如果我发出命令gem install nokogiri,它确实工作,但安装nokogiri-1.6.6.2-x64-mingw32 .

据我了解来自bundle install 的错误消息,它特别想要版本 1.4.5。至少,即使安装了nokogiri-1.6.6.2-x64-mingw32bundle install 仍然会失败并显示上述错误消息。

这可能是一个简单的问题,但由于我是 ruby​​ 新手,我可以使用一些帮助。

我已经尝试过Error installing Nokogiri on bundle install but already installed 的建议,但都没有奏效。

【问题讨论】:

  • stackoverflow.com/q/30322935/123527 是一个可能的解决方案吗?
  • @SimoneCarletti 谢谢,但rake install_deps 步骤在我的机器上失败了。已接受的答案已被编辑以表明它不起作用。
  • 此特定版本的 Nokogiri 在Gemfile.lock 中列出。您可能可以尝试删除该文件,再次运行 bundle install 并查看它是否有效。
  • @katafrakt 这似乎有效!添加您的评论作为答案,我会接受它作为 the 答案:) 谢谢。
  • 请注意,Nokogiri 还没有用于 Ruby 2.2.X 的二进制文件。因此,除非您签出 master 并构建它(最近在 Windows 上启用构建),否则您将不得不降级到 Ruby 2.1.X。抱歉我没早点讲到这个=/

标签: ruby windows bundler


【解决方案1】:

此特定版本的 Nokogiri 在 Gemfile.lock 中列出。您可以删除该文件,再次运行 bundle install 并查看它是否有效。

这更像是一种变通方法而不是正确的解决方案,但是 Gemfile.lock 中的依赖关系已经很老了,所以无论如何刷新它们都是一件好事。

【讨论】:

猜你喜欢
  • 2011-04-14
  • 2021-06-25
  • 1970-01-01
  • 2018-12-11
  • 1970-01-01
  • 2013-12-07
  • 1970-01-01
  • 2015-05-05
  • 1970-01-01
相关资源
最近更新 更多