5

I am trying to install json on windows as follows, but its not working. Please help me with possible resoultion for the same.

C:\Ruby193\bin>gem install --local json-1.8.1.gem
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing json-1.8.1.gem:
        ERROR: Failed to build gem native extension.

    C:/Ruby193/bin/ruby.exe -r ./siteconf20140725-4216-11o740j.rb extconf.rb
creating Makefile

make  clean
Makefile:165: *** target pattern contains no `%'.  Stop.

make
Makefile:165: *** target pattern contains no `%'.  Stop.

make failed, exit code 2

Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.1 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/extensions/x86-mingw32/1.9.1/json-1.8.1/gem_make.out
sakura
  • 2,249
  • 2
  • 26
  • 39
  • Windows always gives trouble. Ruby on rails is not built for windows environment. Try using in ubuntu, you will get more support. – Ashwin Yaprala Jul 25 '14 at 08:56
  • @ashwinkumar Rails actually works okay on Windows. Some things (e.g. compiling gems) are just a bit different and most people do use it on Linux or OS X. Still, Windows is a supported platform. – Holger Just Sep 02 '14 at 11:21

1 Answers1

9

RubyGems 2.4.1 will not build native extensions in Ruby version 1.9.3 and earlier on Windows.

You will need to downgrade RubyGems to 1.8.29. To do this run the following command:

gem update --system 1.8.29

Check gem version:

gem -v
1.8.29

Now try your command again:

gem install --local json-1.8.1.gem

ref: https://groups.google.com/forum/#!topic/rubyinstaller/k19SeJijpKU/discussion

Rots
  • 5,506
  • 3
  • 43
  • 51
  • As the issue is with RubyGems > 2.4.0, you don't need to go all the way down to 1.8.29. Going to 2.3.0 worked for me: 'gem update --system 2.3.0' – Jeffrey Harmon Feb 18 '16 at 21:12