2013-04-17 138 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 

這對我有效。希望這可以幫助。