无法在Windows中安装json gem

我试图在Windows上安装json gem。 我安装了DevKit。 我在下面收到以下错误。 有什么建议? 这个问题

JSON Gem无法安装(Windows)

建议安装DevKit并尝试使用json_pure。 我做了两件事。 问题是我的bundle安装试图安装json,直到安装了json才会继续。 这是一个Rails项目btw的捆绑安装。

d:\source\my_project>gem install json -v '1.6.3' 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:/Ruby200/bin/ruby.exe extconf.rb creating Makefile make generating parser-i386-mingw32.def compiling parser.c In file included from parser.rl:1:0: ../fbuffer/fbuffer.h:129:13: warning: 'fbuffer_append_long' defined but not used [-Wunused-function] ../fbuffer/fbuffer.h:136:17: warning: 'fbuffer_dup' defined but not used [-Wunused-function] ../fbuffer/fbuffer.h:149:14: warning: 'fbuffer_to_s' defined but not used [-Wunused-function] ../fbuffer/fbuffer.h:90:13: warning: 'fbuffer_append_str' defined but not used [-Wunused-function] linking shared-object json/ext/parser.so make install /usr/bin/install -c -m 0755 parser.so C:/Ruby200/lib/ruby/gems/2.0.0/gems/json-1.6.3/ext/json/ext/json/ext /usr/bin/install: cannot create regular file `C:/Ruby200/lib/ruby/gems/2.0.0/gems/json-1.6.3/ext/json/ext/json/ext': No such file or directory make: *** [install-so] Error 1 Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/json-1.6.3 for inspection. Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/json-1.6.3/ext/json/ext/parser/gem_make.out 

我也有这个问题,通过这样做解决了这个问题:

使用Ruby版本 – 2.2.2

Gem版本 – 2.3.0 (如果你有最新的gem版本安装,你可以使用命令降级 – gem update --system 2.3.0

请注意即使你是64位Windows系统,从这里下载并提取32位devkitDevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe

解压缩后,将devkit&mingw \ bin的路径添加到路径变量导航到devkit目录并在命令下运行

 ruby dk.rb init ruby dk.rb install 

最后,重启命令提示符并尝试

 gem install json 

这对我有用。 希望这可以帮助。

我不得不使用1.7.7版本。 我不是为什么,但似乎它与你的ruby版本兼容。 做:gem install json -v’1.7.7′

在我的情况下,我下载错误版本的Ruby(32位),但我使用64位Windows =>错误发生。 您需要做的第一件事是检查开发工具包是否正常工作。

 gem install json --platform=ruby 

如果它不能工作,你应该按照下面的教程使其工作。 https://github.com/oneclick/rubyinstaller/wiki/Development-Kit

在此之后,您可以正常安装json gem。 我认为。 祝好运。