'json'本地gem需要安装构建工具 [英] The 'json' native gem requires installed build tools
问题描述
我在Windows 7机器上安装了 ruby 1.9.2p180(2011-02-18)[i386-mingw32]
。现在我尝试使用命令gem install json安装JSON gem,并得到以下错误消息。
错误:错误安装JSON:
'json'原生gem需要安装构建工具。
请更新您的PATH以包含构建工具或从'[http://rubyinstaller.org/downloads][1]'下载DevKit
并按照说明
at '[http://github.com/oneclick/rubyinstaller/wiki/Development-Kit][2]'
然后我去了下载DevKit-4.5.0-20100819-1536-sfx.exe。将它解压缩到C:\DevKit。然后从命令提示符执行下面的命令。
ruby dk.rb init
在上述命令执行后,我验证了config.yaml已经生成,并且它自动添加了ruby文件夹的路径。这是config.yaml文件底部的一行 - C:/ Ruby192
ruby dk.rb review
当您运行ruby dk.rb install时,我得到了将devkit功能注入到ruby中的消息
ruby dk.rb install
我收到以下消息。
[INFO] RubyGems已经覆盖C:/ Ruby192,正在跳过。
[INFO]正在安装C:/Ruby192/lib/ruby/site_ruby/devkit.rb
现在我尝试使用 gem install json
命令再次执行JSON gem。
错误:安装JSON时出错:
'json'原生gem需要已安装的构建工具.........
我错过了什么吗?
我相信这些安装程序会更改路径。在尝试安装需要devkit的gem之前,是否尝试关闭并重新打开CMD窗口?
另外,确保你的Ruby版本使用了正确的devkit安装程序。 devkit wiki页面上的文档有一个需求说明:
对于RubyInstaller版本1.8.7,1.9.2和1.9.3, DevKit
4.5.2
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]'
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
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
I got the message that devkit functionality will be injected into the rubies when you run "ruby dk.rb install"
ruby dk.rb install
I got the following message.
[INFO] RubyGems override already in place for C:/Ruby192, skipping.
[INFO] Installing C:/Ruby192/lib/ruby/site_ruby/devkit.rb
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.........
Am I missing something?
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?
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:
For RubyInstaller versions 1.8.7, 1.9.2, and 1.9.3 use the DevKit 4.5.2
这篇关于'json'本地gem需要安装构建工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!