在 windows 中为 ruby 安装 json gem 时出错

Error in installing json gem for ruby in windows

当我尝试创建新的 rails 项目时,我遇到了与缺少 json gem.

有关的错误

当我尝试安装 json gem 时,出现此错误:

Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing json:
        ERROR: Failed to build gem native extension.

    C:/Ruby22-x64/bin/ruby.exe extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
generating generator-x64-mingw32.def
compiling generator.c
In file included from c:/Ruby22-x64/include/ruby-2.2.0/ruby/ruby.h:29:0,
                 from c:/Ruby22-x64/include/ruby-2.2.0/ruby.h:33,
                 from ../fbuffer/fbuffer.h:5,
                 from generator.c:1:
c:/Ruby22-x64/include/ruby-2.2.0/ruby/defines.h:26:19: fatal error: stdio.h: No such file or directory
compilation terminated.
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/json-1.8.3 for inspection.
Results logged to C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/json-1.8.3/gem_make.out

如果您想在 Windows 7(64 位)上安装 Ruby 2(或更高版本),您还需要安装 DevKit 64 位。您的 Devkit 必须与您的操作系统兼容。

因此,请确保您在系统上安装了正确的 Ruby 和兼容的 Devkit。

有关详细信息,请参阅 this tutorial

有一组gem相互依存。所以,我不得不一步步安装。

我是根据报错信息一步一步做的,忘记记下步骤了