The 'json' native gem requires installed build tools - ruby

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?

Follow the Instructions from the Ruby Installer Developer Kit Wiki:
Download Ruby 1.9.3 from rubyinstaller.org
Download DevKit file from rubyinstaller.org
For Ruby 1.9.3 use DevKit-tdm-32-4.5.2-20110712-1620-sfx.exe
Extract DevKit to path C:\Ruby193\DevKit
Run cd C:\Ruby193\DevKit
Run ruby dk.rb init
Run ruby dk.rb review
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"

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

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

Followed the steps.
Extract DevKit to path C:\Ruby193\DevKit
cd C:\Ruby192\DevKit
ruby dk.rb init
ruby dk.rb review
ruby dk.rb install
Then I wrote the command
gem install rails -r -y

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

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.

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.

My gem version 2.0.3 and I was getting the same issue.
This command resolved it:
gem install json --platform=ruby --verbose

Related

installation of jekyll failed - Windows

I am trying to install jekyll on a 32 bit windows 7 PC . I downloaded ruby installer-32 bit and 32 bit devkit and extracted un ruby install folder.i got some ssh error which i resolved by temporarily switching to http instead of https and then updated gems as well as installed bundler using
gem install bundler
however gem install jekyll gives following error
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
C:/Ruby21/bin/ruby.exe -r ./siteconf20150109-5804-1k3wbva.rb extconf.rb
No such file or directory - C:/Ruby21/bin/ruby.exe -r ./siteconf20150109-5804-1k
3wbva.rb extconf.rb 2>&1
Gem files will remain installed in C:/Ruby21/lib/ruby/gems/2.1.0/gems/fast-stemm
er-1.0.2 for inspection.
Results logged to C:/Ruby21/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/fas
t-stemmer-1.0.2/gem_make.out
You need to install the Ruby DevKit to fix the error you're seeing. Any sane Ruby install has the ability to build stuff on the fly.
I would start with Julian Thilo's awesome instructions for installing Jekyll on Windows:
Run Jekyll on Windows
If you are installing Ruby only for the purpose of running Jekyll, PortableJekyll will give you a full working Jekyll install in < 5 minutes.
Happy Jekylling...
I tried the same thing on 3 systems and found out that installing ruby gems fixed the issue .. so for anyone coming back at this question , this is how you install jekyll on a windows pc:
1.download and install ruby.
2.download devkit extract in to a folder(preferably inside ruby installation dir) and type in cmd window while in your devkit dir :
ruby dk.rb init
ruby dk.rb install
3.download and install gems by
ruby setup.rb
4. finally :
gem install bundler
gem install jekyll
*bundler is a jekyll dependency
I had the same issue on Windows 10 after installing Ruby+Devkit 2.5.X (x64) with the Windows installer.
The reason was that I changed the default path in the installer and had spaces in the path name. Apparently some make scripts do not like that.
Reinstalling to a path without any spaces fixed the issue.
Also see this related issue on github.
I failed to install "gem install jekyll bundler" when ruby was installed in "c:\program files\Ruby26-x64". After I reinstalled ruby on c:\Ruby26-x64 everything went ok. Seems like installation fails to parse path with blank

Installing Ruby DevKit on Windows

I wish to install the Ruby DevKit on Windows. I'm using Ruby 2.0 on a 32 bit Windows.
Here is my procedure:
After downloading DevKit (for version 2.0), I place the files in C: then I run these two commands:
ruby dk.rb init
then:
dk.rb install ruby
The installation does not work and the console shows me this:
[INFO] Skipping Existing gem override for 'C :/ Ruby200'
[WARN] Skipping Existing DevKit helper library for 'C :/ Ruby200'
Do you have any idea of the problem?
Thank you very much!
Those are warnings that the DevKit is already setup for that Ruby.
If you want to "force" a reinstall of the DevKit vars then you need to do
ruby dk.rb install -f
How did you install Ruby on your windows machine?
I know that RubyInstaller installs a working version of DevKit for you
http://rubyinstaller.org/downloads/
For me the answer of #Azolo was a good hint, but didn't fully work. I needed to run it like this:
ruby dk.rb install --force

Installation issue in sproutcore

I was installing Sproutcore while installation I was facing issue saying that "Error installing Sproutecore: The 'http_parser.rb' native gem requires installed build tools. Please update your PATH to include build tool...".
Check below screenshot of my command prompt.
I thought this error generate because I didn't set ruby path in environment variable but after setting up path I am facing same error. Please advise.
I follow this link to install sproutcore.
Install This DevKit:
https://github.com/downloads/oneclick/rubyinstaller/DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe
after installation go to devkit dir and run this following command
ruby dk.rb init
ruby dk.rb install
gem install rdiscount --platform=ruby

Install ruby devkit on Windows

I'm trying install devkit to instal some gems. I downloaded files and extracted properly and run ruby dk.rb init and file config.yml was created right.
When i run ruby dk.rb install i got this:
[INFO] Skipping existing gem override for 'C:/Ruby200-x64'
[WARN] Skipping existing DevKit helper library for 'C:/Ruby200-x64'
I would delete C:/Ruby200-x64 and re-extract. Then run 64 bit devkit install again. You shouldn't get that error message.
For the record though, I have a working ruby 2.0 on windows 7, and that gem wouldn't build for me either. It installed fine on 1.9.3 though.
In my opinion we're about a year away from seeing 2.0 be usable on windows.

Trying to install dev kit for ruby in windows 7 but fails

I am trying to install the dev kit for ruby for the CommandT plugin for vim and I am hit with
C:\Users\Administrator>gem install rdiscount --platform=ruby
ERROR: Error installing rdiscount:
The 'rdiscount' native gem requires installed build tools.
Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
I have already run install devkit at shown below
C:\devkit>ruby dk.rb init
[INFO] found RubyInstaller v1.9.3 at C:/Ruby193
Initialization complete! Please review and modify the auto-generated
'config.yml' file to ensure it contains the root directories to all
of the installed Rubies you want enhanced by the DevKit.
C:\devkit>ruby dk.rb review
Based upon the settings in the 'config.yml' file generated
from running 'ruby dk.rb init' and any of your customizations,
DevKit functionality will be injected into the following Rubies
when you run 'ruby dk.rb install'.
C:/Ruby193
C:\devkit>ruby dk.rb install
[INFO] RubyGems override already in place for C:/Ruby193, skipping.
[WARN] DevKit helper library already exists for C:/Ruby193, skipping.
What could be possibly going wrong?
Edit: I tried
c:\devkit>ruby dk.rb install --force
Configures an MSYS/MinGW based Development Kit (DevKit) for
each of the Ruby installations on your Windows system. The
DevKit enables you to build many of the available native
C-based RubyGems that don't yet have a binary gem.
Usage: ruby dk.rb COMMAND
where COMMAND is one of:
init prepare DevKit for installation
review review DevKit install plan
install install required DevKit executables
uninstalled and installed again with a clean directory. But the error remains the same.
On this lines:
C:\devkit>ruby dk.rb install
[INFO] RubyGems override already in place for C:/Ruby193, skipping.
[WARN] DevKit helper library already exists for C:/Ruby193, skipping.
It's telling you that it didn't install the DevKit for Ruby because it already had a previous DevKit registered there.
It might be possible you relocated a previous installation of DevKit, in which case you need to perform ruby dk.rb install --force to override the RubyGems and DevKit helper script it previously skipped.
Hope that helps.
I had the same problem with ruby dk.rb install, however, as suggested with the --force option it has successfully installed my devkit which in turn had resolved a gem install failure I was getting with JSON 1.4.6 gem.

Resources