2

I have installed Ruby 1.92 in my computer, and would like to intall rails.

When I run: gem install rails, I get error message as below:

*D:\Ruby192\Devkit>gem install rails
*ERROR:  Error installing rails:
        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' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'**

Then I download DevKit 4.5.2 or DevKit 3.5 and try them both as:

D:\Ruby192\Devkit>ruby dk.rb init

I always get error message:

d:/Ruby192/lib/ruby/1.9.1/win32/registry.rb:175:in `tr': invalid byte sequence in UTF-8 (ArgumentError)
        from d:/Ruby192/lib/ruby/1.9.1/win32/registry.rb:175:in `initialize'
        from d:/Ruby192/lib/ruby/1.9.1/win32/registry.rb:233:in `exception'
        from d:/Ruby192/lib/ruby/1.9.1/win32/registry.rb:233:in `raise'
        from d:/Ruby192/lib/ruby/1.9.1/win32/registry.rb:233:in `check'
        from d:/Ruby192/lib/ruby/1.9.1/win32/registry.rb:256:in `OpenKey'
        from d:/Ruby192/lib/ruby/1.9.1/win32/registry.rb:387:in `open'
        from d:/Ruby192/lib/ruby/1.9.1/win32/registry.rb:498:in `open'
        from dk.rb:118:in `block in scan_for'
        from dk.rb:116:in `each'
        from dk.rb:116:in `scan_for'
        from dk.rb:138:in `block in installed_rubies'
        from dk.rb:138:in `collect'
        from dk.rb:138:in `installed_rubies'
        from dk.rb:146:in `init'
        from dk.rb:313:in `run'
        from dk.rb:332:in `<main>'

Have you guys got any suggestion on the problem?

matt
  • 78,533
  • 8
  • 163
  • 197
Wesley
  • 21
  • 2

2 Answers2

1

I have encountered the same situation. I think that you may want to install json library. You should use msys.bat and install json on this terminal.

  1. Execute msys.bat in a DevKit directory -> it invokes a new terminal.
  2. gem install json on this terminal.
  3. You can continue gem install rails.
Maehler
  • 6,111
  • 1
  • 41
  • 46
m-kaz
  • 11
  • 1
1

The problem was solved for me by clearing the LANG environment variable first:

set LANG=
ruby dk.rb init

The idea comes from this question on the RubyInstaller Google Group.

Christian Davén
  • 16,713
  • 12
  • 64
  • 77