The 'json' native gem requires installed build tools

RubyJsonWindows 7Rubygems

Ruby Problem Overview


I have ruby 1.9.2p180 (2011-02-18) [i386-mingw32] installed on my windows 7 machine. Now I tried to install the JSON gem using the command, "gem install json" and got the following error.

ERROR:  Error installing JSON:
    The 'json' native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from '[http://rubyinstaller.org/downloads][1]' and follow the instructions
at '[http://github.com/oneclick/rubyinstaller/wiki/Development-Kit][2]'

Then I went and downloaded DevKit-4.5.0-20100819-1536-sfx.exe. Extracted it to C:\DevKit. And then from the command prompt, I executed the following commands.

ruby dk.rb init

After the above command is executed, I verified that config.yaml is generated and it has the path for my ruby folder added automatically. This is the line at the bottom of the config.yaml file "- C:/Ruby192"

ruby dk.rb review

I got the message that devkit functionality will be injected into the rubies when you run "ruby dk.rb install"

ruby dk.rb install

I got the following message.

[INFO] RubyGems override already in place for C:/Ruby192, skipping.
[INFO] Installing C:/Ruby192/lib/ruby/site_ruby/devkit.rb

Now I tried executing the JSON gem again using the command gem install json. Then got the same error message as before.

ERROR:  Error installing JSON:
    The 'json' native gem requires installed build tools.........

Am I missing something?

Ruby Solutions


Solution 1 - Ruby

Follow the Instructions from the Ruby Installer Developer Kit Wiki:

  1. Download Ruby 1.9.3 from rubyinstaller.org
  2. Download DevKit file from rubyinstaller.org
  1. Extract DevKit to path C:\Ruby193\DevKit
  2. Run cd C:\Ruby193\DevKit
  3. Run ruby dk.rb init
  4. Run ruby dk.rb review
  5. Run ruby dk.rb install

To return to the problem at hand, you should be able to install JSON (or otherwise test that your DevKit successfully installed) by running the following commands which will perform an install of the JSON gem and then use it:

gem install json --platform=ruby
ruby -rubygems -e "require 'json'; puts JSON.load('[42]').inspect"

Solution 2 - Ruby

I believe those installers make changes to the path. Did you try closing and re-opening the CMD window after running them and before the last attempt to install the gem that wants devkit present?

Also, be sure you are using the right devkit installer for your version of Ruby. The documentation at devkit wiki page has a requirements note saying:

> For RubyInstaller versions 1.8.7, 1.9.2, and 1.9.3 use the DevKit > 4.5.2

Solution 3 - Ruby

I have found that the error is sometimes caused by a missing library.

so If you install RDOC first by running

gem install rdoc

then install rails with:

gem install rails

then go back and install the devtools as mentioned before with:

  1. Extract DevKit to path C:\Ruby193\DevKit
  2. cd C:\Ruby192\DevKit
  3. ruby dk.rb init
  4. ruby dk.rb review
  5. ruby dk.rb install

then try installing json

which culminate with you finally being able to run

rails new project_name - without errors.

good luck

Solution 4 - Ruby

Followed the steps.

  1. Extract DevKit to path C:\Ruby193\DevKit
  2. cd C:\Ruby192\DevKit
  3. ruby dk.rb init
  4. ruby dk.rb review
  5. ruby dk.rb install

Then I wrote the command

gem install rails -r -y

Solution 5 - Ruby

  1. Download Ruby 1.9.3

  2. cmd check command: ruby -v 'return result ruby 1.9.3 then success full install ruby

  3. Download DevKit file from http://rubyinstaller.org/downloads (DevKit-tdm-32-4.5.2-20110712-1620-sfx.exe)

  4. Extract DevKit to path C:\Ruby193\DevKit

  5. cd C:\Ruby193\DevKit

  6. ruby dk.rb init

  7. ruby dk.rb review

  8. ruby dk.rb install

  9. cmd : gem install rails -v3.1.1 'few time installing full process'

  10. cmd : rails -v 'return result rails 3.1.1 then its success fully install'

enjoy Ruby on Rails...

Solution 6 - Ruby

I would like to add that you should make sure that the generated config.yml file when doing ruby dk.rb init contains the path to the ruby installation you want to use DevKit with. In my case, I had the Heroku Toolbelt installed on my system, which provided its own ruby installation, located at a different place. The config.yml file used that particular installation, and that's not what I wanted. I had to manually edit the file to point it to the correct one, then continue with ruby dk.rb review, etc.

Solution 7 - Ruby

My solution is simplier and checked on Ruby 2.0. It also enable download Json. (run CMD.exe as administrator)

    C:\RubyDev>devkitvars.bat
    Adding the DevKit to PATH...

And then write again gem command.

Solution 8 - Ruby

My gem version 2.0.3 and I was getting the same issue. This command resolved it:

gem install json --platform=ruby --verbose

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionsridhar249View Question on Stackoverflow
Solution 1 - RubyMassimo FazzolariView Answer on Stackoverflow
Solution 2 - RubyChuck van der LindenView Answer on Stackoverflow
Solution 3 - RubyPhineas DashevskyView Answer on Stackoverflow
Solution 4 - RubyEvangelos AlimpertisView Answer on Stackoverflow
Solution 5 - RubyRavi ParsaniaView Answer on Stackoverflow
Solution 6 - Rubymarco-fisetView Answer on Stackoverflow
Solution 7 - RubyArtur_PLView Answer on Stackoverflow
Solution 8 - RubyChitresh goyalView Answer on Stackoverflow