Install Ruby JSON Gem on Windows

When attempting to install the Ruby JSON gem on Windows you are most likely going to get an error similar to the below. The trick is to instead install json_pure gem using the syntax listed below the error.

Error:

C:>gem install json
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.

C:/ruby/bin/ruby.exe extconf.rb install json
creating Makefile

nmake
'nmake' is not recognized as an internal or external command, operable program or batch file.

Gem files will remain installed in C:/ruby/lib/ruby/gems/1.8/gems/json-1.1.3 for inspection.
Results logged to C:/ruby/lib/ruby/gems/1.8/gems/json-1.1.3/ext/json/ext/parser/gem_make.out

Install json_pure gem:

gem install json_pure

That should do it.

Share