json gem不会安装在Windows上

时间:2012-01-18 21:25:14

标签: ruby-on-rails-3 json gem

这是我一直在犯的错误。我安装了DevKit并遵循了所有说明。

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:/Program Files/Ruby/Ruby192/bin/ruby.exe" extconf.rb
creating Makefile

make
Makefile:160: warning: overriding commands for target `C:/Program'
Makefile:153: warning: ignoring old commands for target `C:/Program'
C:/Program Files/Ruby/Ruby192/bin/ruby -e "puts 'EXPORTS', 'Init_parser'"  > par
ser-i386-mingw32.def
/bin/sh: C:/Program: No such file or directory
make: *** [parser-i386-mingw32.def] Error 127


Gem files will remain installed in C:/Program Files/Ruby/Ruby192/lib/ruby/gems/1.9.1/gems/json-1.6.3 for inspection.
Results logged to C:/Program Files/Ruby/Ruby192/lib/ruby/gems/1.9.1/gems/json-1.6.3/ext/json/ext/parser/gem_make.out

有没有人有解决方案?

1 个答案:

答案 0 :(得分:10)

也遇到了这个问题。通过Installing dm-types on Windows. (Win7 x64):修复了它:


看起来ruby路径中的空格正在搞乱makefile。也许尝试暂时在Windows上创建符号链接,例如:

mklink /d c:\ruby "C:\Program Files (x86)\Ruby\Ruby193"

然后尝试使用c:\​​ ruby​​ \ bin \ ruby​​.exe进行安装。您可以在安装后删除符号链接。