The 'json' native gem requires installed build tools

128,637

Solution 1

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 2

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
  3. Extract DevKit to path C:\Ruby193\DevKit
  4. Run cd C:\Ruby193\DevKit
  5. Run ruby dk.rb init
  6. Run ruby dk.rb review
  7. 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 3

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

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

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...

Share:
128,637

Related videos on Youtube

sridhar249
Author by

sridhar249

Passionate about programming. Loves working on UI and API based software automation projects, Designing the frame work.

Updated on August 26, 2020

Comments

  • sridhar249
    sridhar249 over 3 years

    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?

  • sridhar249
    sridhar249 over 12 years
    Hi Chuck van, I closed the CMD window and opened it again and ran the "gem install json". It did not help either. Still the same error as i mentioned in the question. I even tried installing ruby 1.9.2 on another Windows 2003 machine we have in our office, installed devkit and then tried "gem install json". I see the same problem. ("ERROR: Error installing json: The 'json' native gem requires installed build tools........."). Any other suggestions? Do you need more info from me?
  • sridhar249
    sridhar249 over 12 years
    As i already mentioned in the question i am using "DevKit-4.5.0-20100819-1536-sfx.exe". I believe this is the correct devkit to use with Ruby1.9.2.
  • Chuck van der Linden
    Chuck van der Linden over 12 years
    did you follow all the instructions on this page? github.com/oneclick/rubyinstaller/wiki/Development-Kit. the devkit is a self extracting archive, if all you did was run the file you downloaded, you are only part way though installing it.
  • sridhar249
    sridhar249 over 12 years
    yes. I did follow all the instructions. Finally i got it working. I tried using "DevKit-tdm-32-4.5.2-20110712-1620-sfx.exe" instead of "DevKit-4.5.0-20100819-1536-sfx.exe" and it worked for me. Thanks for all your support Chuck Van.
  • WSkid
    WSkid about 12 years
    Would like to add that you need to make sure whatever prompt you are using has admin rights or you will get errors during the install (win8 at least)
  • peakit
    peakit about 12 years
    Faced the same issue, tried the above steps and wow it worked fine !! +1
  • corlettk
    corlettk about 12 years
    Worked for me with //Ruby 1.9.3-p194// ... the "gotcha" appears to be that the DevKit must be a subdirectory of your Ruby directory... or maybe it's that your Ruby directory must be in the root of the drive. Phew, glad that's working. It's been driving me crazy for hours.
  • Rails beginner
    Rails beginner about 12 years
    Also worked for me, remember to put the DevKit folder in the ruby folder. Else it wont work.
  • Jus12
    Jus12 almost 11 years
    1.9.3 p0 is not longer there in downloads. Maybe you should mention that use any 1.9.3 (if it does work, that is). It worked for me.
  • Alexander Popov
    Alexander Popov almost 11 years
    One very important thing: after you install the DevKit make sure the path to it is included in the PATH environmental variable. Otherwise it won't work.
  • CJBrew
    CJBrew over 10 years
    Works for Ruby 2.0 too.
  • ktang
    ktang almost 10 years
    I followed the instructions, it worked for me. C:\DevKit>gem install json Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... Successfully installed json-1.8.1 1 gem installed Installing ri documentation for json-1.8.1... Installing RDoc documentation for json-1.8.1...
  • prespic
    prespic almost 10 years
    One more note. The python has to be installed and be sure you have the path in PATH variable.
  • Matthew Blott
    Matthew Blott almost 10 years
    Gosh, I've been looking everywhere to fix this and this done it. Well done, have an up vote :-)
  • jahackbeth
    jahackbeth over 9 years
    This is the only solution that worked for Ruby 1.9.3 on Windows 7.
  • Ravi Parsania
    Ravi Parsania over 9 years
    ya its only for windows 7
  • Pavel 'PK' Kaminsky
    Pavel 'PK' Kaminsky over 9 years
    make sure the path in config.yaml is correct before you proceed to ruby dk.rb review and ruby dk.rb install. for me init auto discovered the ruby version coming with my Heroku install instead my 2.0.0 installed in a different location
  • Matheus Felipe
    Matheus Felipe over 8 years
    This is much better and succinct than the official documentation. Working beautifully with Ruby 2.2 (32bits)
  • Marcello Grechi Lins
    Marcello Grechi Lins over 7 years
    Worked for ruby 2.0.x. Clear instructions and straight to the point
  • Ravinder Payal
    Ravinder Payal about 7 years
    Yes brother, it also works on windows 7 and Ruby /DevKit 2.3.x
  • Bhabani Sankar Mishra
    Bhabani Sankar Mishra about 7 years
    I installed using gem install devkit, is that method wrong?
  • Bhabani Sankar Mishra
    Bhabani Sankar Mishra about 7 years
    I installed using gem install devkit, is that method wrong?