ERROR: 在Windows上构建gem本地扩展失败[英] ERROR: Failed to build gem native extension on Windows

本文是小编为大家收集整理的关于ERROR: 在Windows上构建gem本地扩展失败的处理方法,想解了ERROR: 在Windows上构建gem本地扩展失败的问题怎么解决?ERROR: 在Windows上构建gem本地扩展失败问题的解决办法?那么可以参考本文帮助大家快速定位并解决问题。

问题描述

安装"redcarpet"gem 时出现以下错误.不过,它在我朋友的机器上安装没有问题.(我想安装它来运行 yard)Ruby 版本:1.9.3

cmd输出:

D:\Learning\Common_POM_FW\SampleProjects>yard
[error]: Missing 'redcarpet' gem for Markdown formatting. Install it with `gem install redcarpet`

D:\Learning\Common_POM_FW\SampleProjects>gem install redcarpet
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing redcarpet:
        ERROR: Failed to build gem native extension.

    C:/Ruby193/bin/ruby.exe -r ./siteconf20141009-6544-978w4t.rb extconf.rb
creating Makefile

make  clean
Makefile:165: *** target pattern contains no `%'.  Stop.

make
Makefile:165: *** target pattern contains no `%'.  Stop.

make failed, exit code 2

Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/redcarpet-3.1.2 for inspectio
n.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/extensions/x86-mingw32/1.9.1/redcarpet-3.1.2/gem_ma
ke.out

更新:使用 https://github.com/oneclick/rubyinstaller/wiki/提供的 devkit 安装说明Development-Kit 当我使用 json gem 测试安装时,它也失败了:(

我通过 github 中的故障排除链接 原生 gem 扩展错误 并按照说明解决,但问题仍然存在..

我将两个路径添加到 Env var C:\\ruby_devkit\\bin;C:\\ruby_devkit\\mingw\\bin; 这会删除行 Temporarily enhancing PATH to include DevKit... 出现在 cmd 上

推荐答案

经过大量研究,我发现罪魁祸首是RubyGems版本与原生扩展gems不兼容!!!

我有 ruby​​ gems ver 2.4.1 但似乎 >2.4.0 有这些问题

gem update --system 2.3.0 帮了我大忙 :)

参考:https://github.com/rubygems/rubygems/issues/977

本文地址:https://www.itbaoku.cn/post/786558.html