开发者

Cannot install JSON gem in rails using windows

开发者 https://www.devze.com 2023-04-13 01:38 出处:网络
I am doing a bundle install and all of the gems work fine except JSON when it get to the JSON gem I receive this error.

I am doing a bundle install and all of the gems work fine except JSON when it get to the JSON gem I receive this error.

Installing json (1.6.1) with native extensions c:/Ruby192/l开发者_开发问答ib/ruby/site_ruby/1.9.1/rubygems/installer.rb:55
    2:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::E
    xtensionBuildError)

            c:/Ruby192/bin/ruby.exe extconf.rb
    checking for re.h... *** 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.

Any idea on what could be causing this error?


You are working with Windows, so the RubyInstaller Development Kit may help you: http://rubyinstaller.org/add-ons/devkit/

The devkit installs a C-compiler (and some other stuff) to compile C-written parts.

Install it and try again to install the gem - perhaps with option --platform=ruby.

Details can be found at https://github.com/oneclick/rubyinstaller/wiki/Development-Kit


That's because this gem using a piece of code written on C. For working properly you need c compiler installed on your machine. As a way, try to use json_pure written on pure Ruby


I'm not an expert in ROR, but the JSON installation issue which I got while installing Redmine was resolved by doing the following:

  • Create a make.bat at D:\LANGS\MinGW\bin
  • Keep this directory in the PATH
  • Edit the above make.bat and add a line, D:\LANGS\MinGW\msys\1.0\bin\make.exe

What I realized is, mingw32-make.exe never worked, but 'D:\LANGS\MinGW\msys\1.0\bin\make.exe' worked.

Note: My MinGW installation is under D:\LANGS\ . Please make the changes accordingly in your specific installation.


Yes, install the development kit. Also, You will need to run a few command lines to install it (not just simply download and run).

Download it, run it to extract it somewhere (permanent). Then cd to it, run ruby dk.rb init and ruby dk.rb install to bind it to ruby installations in your path.

A guide for that is here:

https://github.com/oneclick/rubyinstaller/wiki/Development-Kit

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号