Environment: win7, ruby1.9.3p392 (despise me. Isn't it hard to find rails in win? I just don't bother to switch to Linux sometimes. Well, I only want to use win occasionally and hope it can run .)
Error: running in a rails ProjectBundle install(Or set up an octopress blog.Bundle installOther gems can be correctly installed.JSONHere is an inexplicable error =. =
As follows:
Installing JSON (1.7.7) GEM: Installer: extensionbuilderror: Error: failed to build gem native extension. c:/ruby193/bin/ruby.exe extconf. rbcreating makefilemake generating generator-i386-mingw32.defcompiling generator. cin file encoded ded from C:/ruby193/include/ruby-1.9.1/Ruby. h: 32: 0, from .. /fbuffer. h: 5, from generator. c: 1: C:/ruby193/include/ruby-1.9.1/Ruby. h: 109: 14: Error: size of Array 'Ruby _ check_sizeof_voidp 'is negative... // n rows = are omitted here. =
After checking various information, I finally found out that this is the reason why the C compiler is used in JSON,
Method 1:
See the solution to this problem on so.
Http://stackoverflow.com/questions/7780756/cannot-install-json-gem-in-rails-using-windows
According to this statement, only oneDevkitOn the line, download link: http://rubyinstaller.org/downloads/
Use please stamp https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
Method 2:
The reason why I don't describe it in detail is that this method is useless on my computer !!!
It's okay to switch back to Linux. JSON is not enough. So don't try rails again in win !!!!
But I found a new method last night, written in Ruby only.Json_pureJSON is replaced,
The specific method is as follows:
FindGemfile. Lock, Open it in a text editor and findJSON 1.7.7ChangeJson_pure 1.7.7
Run bundle install, and the your bunlde is complete. (Considering the instability of rubygems.org, we recommend using the http://ruby.taobao.org gem)
This sacrifices the demand for speed. After all, C runs faster =. = Is a solution ..