问题描述
我的 Windows 7 机器上安装了 ruby 1.9.2p180 (2011-02-18) [i386-mingw32]
.现在我尝试使用命令gem install json"安装 JSON gem,并收到以下错误.
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]'
然后我去下载了 DevKit-4.5.0-20100819-1536-sfx.exe.将其解压缩到 C:DevKit.然后在命令提示符下,我执行了以下命令.
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
执行上述命令后,我验证生成了 config.yaml 并自动添加了我的 ruby 文件夹的路径.这是 config.yaml 文件-C:/Ruby192"底部的行
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
我收到消息说,当您运行ruby dk.rb install"时,devkit 功能将被注入到 rubies 中
I got the message that devkit functionality will be injected into the rubies when you run "ruby dk.rb install"
ruby dk.rb install
我收到以下消息.
[INFO] RubyGems override already in place for C:/Ruby192, skipping.
[INFO] Installing C:/Ruby192/lib/ruby/site_ruby/devkit.rb
现在我尝试使用命令 gem install json
再次执行 JSON gem.然后得到了和以前一样的错误信息.
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.........
我错过了什么吗?
推荐答案
我相信那些安装程序会更改路径.您是否尝试在运行 CMD 窗口之后以及在最后一次尝试安装需要 devkit 的 gem 之前关闭并重新打开它们?
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?
另外,请确保您为您的 Ruby 版本使用了正确的 devkit 安装程序.devkit wiki 页面上的文档有一个要求说明:
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:
对于 RubyInstaller 版本 1.8.7、1.9.2 和 1.9.3,请使用 DevKit4.5.2
这篇关于“json"原生 gem 需要安装构建工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!