2013-04-17 144 views
0

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

JSON Gem will not install (Windows)

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

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 

回答

0

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

0

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

gem install json --platform=ruby 

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

然后,你可以安装json gem normaly。我认为。 祝你好运。

0

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

使用的Ruby版本 - 2.2.2

宝石版本 - 2.3.0(如果您有最新的宝石版本上安装您可以使用降级命令 - gem update --system 2.3.0

请注意,即使你是64位Windows系统,下载并解压32位的devkit(的devkit-mingw64-32-4.7.2-20130224-1151-sfx.exe) F ROM here

一旦提取,添加路径的devkit &的MinGW \ bin添加到您的路径变量 导航到的devkit目录&下方运行命令

ruby dk.rb init 

ruby dk.rb install 

最后,重新启动命令提示符&尝试

gem install json 

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