ERROR: Error installing json:The 'json' native gem requires installed build tools.
C:\ruby\blog>gem install json -v '1.8.3'
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' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
在 windows下搭建Ruby Rails Web开发环境 时遇到这个问题,
发生这个错误的原因是没有安装DevKit
DevKit
加上devkit之后,你的ruby中便具有了一个mingw32的本地编译环境,而且这个本地编译环境是自动调用的。只有在你要安装的gem需要本地编译时,才会调用devkit。
http://rubyinstaller.org/add-ons/devkit
下载DevKit
http://rubyinstaller.org/downloads
安装DevKit
1、运行,解压到一个目录,例如:C:\DevKit
2、打开命令行,切换到这个目录;
3、执行命令:ruby dk.rb init
4、修改config.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:\Ruby22-x64
- # - C:/ruby192dev
- ---