【问题标题】:Error in installing json gem for ruby in windows在 Windows 中为 ruby​​ 安装 json gem 时出错
【发布时间】:2015-10-12 15:27:52
【问题描述】:

当我尝试创建新的 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

【问题讨论】:

  • 请粘贴您的 Gemfile。

标签: ruby-on-rails ruby json rubygems


【解决方案1】:

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

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

更多信息请参见this tutorial

【讨论】:

  • 我已经安装了 64 位版本的 devKit。实际上,我遵循了在 Rails 上安装 ruby​​ 的说明,其中包括 devkit 安装。操作系统是:windows 10
【解决方案2】:

有一组宝石相互依存。所以,我只好一步一步安装。

由于我是根据错误消息并一一进行的,因此我忘记记录有关步骤。

【讨论】:

    猜你喜欢
    • 2014-01-24
    • 1970-01-01
    • 1970-01-01
    • 2013-04-24
    • 2012-06-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多