본문 바로가기

공부방/Ruby&Rails

windows rails3 install Error "The 'json' native gem requires installed build tools."

C:\Users\rin>gem install rails
Fetching: multi_json-1.0.3.gem (100%)
Fetching: activesupport-3.1.1.gem (100%)
Fetching: builder-3.0.0.gem (100%)
Fetching: i18n-0.6.0.gem (100%)
Fetching: activemodel-3.1.1.gem (100%)
Fetching: rack-1.3.5.gem (100%)
Fetching: rack-cache-1.1.gem (100%)
Fetching: rack-test-0.6.1.gem (100%)
Fetching: rack-mount-0.8.3.gem (100%)
Fetching: hike-1.2.1.gem (100%)
Fetching: tilt-1.3.3.gem (100%)
Fetching: sprockets-2.0.3.gem (100%)
Fetching: erubis-2.7.0.gem (100%)
Fetching: actionpack-3.1.1.gem (100%)
Fetching: arel-2.2.1.gem (100%)
Fetching: tzinfo-0.3.30.gem (100%)
Fetching: activerecord-3.1.1.gem (100%)
Fetching: activeresource-3.1.1.gem (100%)
Fetching: mime-types-1.17.2.gem (100%)
Fetching: polyglot-0.3.3.gem (100%)
Fetching: treetop-1.4.10.gem (100%)
Fetching: mail-2.3.0.gem (100%)
Fetching: actionmailer-3.1.1.gem (100%)
Fetching: thor-0.14.6.gem (100%)
Fetching: rack-ssl-1.3.2.gem (100%)
Fetching: json-1.6.1.gem (100%)
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'


json이 build 툴을 필요로 한다.

이 툴은 http://github.com/oneclick/rubyinstaller/wiki/Development-Kit 에서 받을 수 있다.

 

http://rubyinstaller.org/downloads/ 에서 다운로드 링크에 접근할 수 있었다.

다운로드 링크 : http://github.com/downloads/oneclick/rubyinstaller/DevKit-tdm-32-4.5.2-20110712-1620-sfx.exe

 

속도가 상당히 느리다.

 

그동안 영문으로 된 설치과정을 정리한다.

 

요구사항은 윈도 xp(32 or 64bit) 이상. RubyInstaller로 설치된 루비가 필요하다 한다.

뭐.. 설치파일로 설치했으니 맞겠지..


설치순서

받은 파일을 C:\DevKit 같은 곳에다가 푼다. 디렉토리명에는 공백이 없어야 한다.

잉? 다 받아졌네 

받았는데 압축파일이 아니라 exe파일이다.

음.. 실행하니 7-Zip self-extracting archive다

기본 대상 디렉토리가 C:\Users\유저명\Downloads\로 되어 있는데 그냥 설명서대로 C:\DevKit에다 푼다
 
음.. 다 풀렸다.

다음으로... 설치 스크립트를 실행해야 한단다.
 
cmd 창에서 설치 폴더로 이동한다. C:\DevKit다.
 
그리고 아래와 같이 입력한다.

C:\DevKit>ruby dk.rb

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
RubyGems that don't yet have a binary gem.

Usage: ruby dk.rb COMMAND [options]

where COMMAND is one of:

  init     prepare DevKit for installation
  review   review DevKit install plan
  install  install required DevKit executables

and 'install' [options] are:

  -f, --force  overwrite existing helper scripts

어라? 뭔가 잘 안된 것 같다. Usage를 보니 ruby dk.rb 뒤에 먼가 커맨드를 줘야한다.
 
C:\DevKit>ruby dk.rb init

[INFO] found RubyInstaller v1.9.2 at C:/Ruby192

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.

 
init을 붙여줘야 저렇게 자동으로 루비인스톨러를 찾아 config.yml을 만든다.

생성된 yml 파일은 아래와 같다.

# This configuration file contains the absolute path locations of all
# installed Rubies to be enhanced to work with the DevKit. This config
# file is generated by the 'ruby dk.rb init' step and may be modified
# before running the 'ruby dk.rb install' step. To include any installed
# Rubies that were not automagically discovered, simply add a line below
# the triple hyphens with the absolute path to the Ruby root directory.
#
# Example:
#
# ---
# - C:/ruby19trunk
# - C:/ruby192dev
#
--- 
- C:/Ruby192

자동으로 찾지 못한 루비가 있을 경우 여기에 추가해주면 된단다.
 
수정한 경우 잘 됐는지 확인해보기 위해 ruby dk.rb review 명령어를 쓸 수 있다한다.

수정안했으니 패스.

마지막으로 ruby dk.rb install 해준다.

C:\DevKit>ruby dk.rb install
[INFO] Updating convenience notice gem override for 'C:/Ruby192'
[INFO] Installing 'C:/Ruby192/lib/ruby/site_ruby/devkit.rb'


뭔가 후딱 끝나버린다. 된건가?

된건지는 모르겠지만 일단 끝났으니 아까 실패했던 작업을 다시 해 본다.


C:\DevKit>ruby dk.rb install
[INFO] Updating convenience notice gem override for 'C:/Ruby192'
[INFO] Installing 'C:/Ruby192/lib/ruby/site_ruby/devkit.rb'

C:\DevKit>gem install json
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed json-1.6.1
1 gem installed
Installing ri documentation for json-1.6.1...
Installing RDoc documentation for json-1.6.1...

잘 된다.

C:\DevKit>gem list

*** LOCAL GEMS ***

actionmailer (3.1.1)
actionpack (3.1.1)
activemodel (3.1.1)
activerecord (3.1.1)
activeresource (3.1.1)
activesupport (3.1.1)
arel (2.2.1)
builder (3.0.0)
bundler (1.0.21)
erubis (2.7.0)
hike (1.2.1)
i18n (0.6.0)
json (1.6.1)
mail (2.3.0)
mime-types (1.17.2)
minitest (1.6.0)
multi_json (1.0.3)
polyglot (0.3.3)
rack (1.3.5)
rack-cache (1.1)
rack-mount (0.8.3)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.1.1)
railties (3.1.1)
rake (0.8.7)
rdoc (3.11, 2.5.8)
rubygems-update (1.8.11)
sprockets (2.0.3)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.30)

 
[출처 : http://www.cyworld.com/keis8]