ERROR: Failed to build gem native extension on Windows

喜夏-厌秋 提交于 2019-12-21 05:11:29

问题


I'm getting the below error while installing 'redcarpet' gem. It got installed without issue on my friends machine though. (I want to install this to run yard) Ruby version: 1.9.3

cmd output:

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

UPDATE: With the devkit installation instructions provided at https://github.com/oneclick/rubyinstaller/wiki/Development-Kit When I test the installation with json gem it fails there too :(

I went through the link for troubleshoot in github Native gem extension Error and followed the instructions to solve, Yet the problem persists..

I added the two paths to Env var C:\\ruby_devkit\\bin;C:\\ruby_devkit\\mingw\\bin; This removes the line Temporarily enhancing PATH to include DevKit... from appearing on cmd


回答1:


Finally after much research I found the culprit was the RubyGems version incompatibility with native extension gems!!!

I had ruby gems ver 2.4.1 but seems like >2.4.0 has these issues

gem update --system 2.3.0 did the trick for me :)

Refer: https://github.com/rubygems/rubygems/issues/977




回答2:


Downgrading ruby gems didn't work for me.

What did work was (with the latest version of ruby gems installed):

Open CMD as administrator and...

gem install json --platform=ruby --verbose

(Answer added by dannysmith here)



来源:https://stackoverflow.com/questions/26276207/error-failed-to-build-gem-native-extension-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!