ERROR: Error installing json:The 'json' native gem requires installed build tools.

11 篇文章 0 订阅

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文件

[plain]  view plain copy
  1. # This configuration file contains the absolute path locations of all  
  2. # installed Rubies to be enhanced to work with the DevKit. This config  
  3. # file is generated by the 'ruby dk.rb init' step and may be modified  
  4. # before running the 'ruby dk.rb install' step. To include any installed  
  5. # Rubies that were not automagically discovered, simply add a line below  
  6. # the triple hyphens with the absolute path to the Ruby root directory.  
  7. #  
  8. # Example:  
  9. #  
  10. # ---  
  11. - C:\Ruby22-x64  
  12. # - C:/ruby192dev  
  13. #  
  14. ---  
[plain]  view plain copy
  1. C:\Ruby22-x64 是我的Ruby安装目录  

5、执行命令:ruby dk.rb install

[plain]  view plain copy
  1. C:\DevKit>ruby dk.rb install  
  2. [INFO] Updating conve

安装完DevKit之后,再执行命令安装JSON包:gem install json -v '1.8.3'

安装过程中可能会出现以下问题:

C:\ruby\blog>gem install json -v '1.8.3'
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    Errno::ECONNABORTED: An established connection was aborted by the software i
n your host machine. - SSL_connect (https://api.rubygems.org/quick/Marshal.4.8/json-1.8.3.gemspec.rz)
这可能是由于网络的原因,多试几次就好了。

https://github.com/oneclick/rubyinstaller/wiki/Development-Kit

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值