gem install json -v 1.7.3 给出“请更新您的 PATH 以包含构建工具”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10694997/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 18:20:39  来源:igfitidea点击:

gem install json -v 1.7.3 gives 'Please update your PATH to include build tools'

ruby-on-rails-3jsonwindows-8build-tools

提问by Joe

When I run:

当我运行时:

rails new blog

I get:

我得到:

Installing json (1.7.3)
Gem::InstallError: 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'
An error occurred while installing json (1.7.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.3'` succeeds before bundling.

When I run:

当我运行时:

gem install json -v 1.7.3

I get:

我得到:

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'

I'm using Windows 8. I do have c:\ruby193\binin my path. What do I do to remedy these errors?

我使用的是 Windows 8。我确实c:\ruby193\bin在使用 Windows 8 。我该怎么做才能纠正这些错误?

回答by Julien Pellet

Make sure you install the devkit (ticking the checkboxes that will update the path) : You might need to reinstall ruby too.

确保安装了 devkit(勾选将更新路径的复选框):您可能还需要重新安装 ruby​​。

Install the DevKit

安装开发套件

Download Development Kit from here http://rubyinstaller.org/downloads/

从这里下载开发工具包http://rubyinstaller.org/downloads/

DevKit url at this time For use with Ruby 1.8.7 and 1.9.3: DevKit-tdm-32-4.5.2

此时的 DevKit url 用于 Ruby 1.8.7 和 1.9.3:DevKit-tdm-32-4.5.2

For use with Ruby 2.0 and above (32bits version only): DevKit-mingw64-32-4.7.2

用于 Ruby 2.0 及更高版本(仅限 32 位版本): DevKit-mingw64-32-4.7.2

For use with Ruby 2.0 and above (x64 - 64bits only) DevKit-mingw64-64-4.7.2

用于 Ruby 2.0 及更高版本(仅限 x64 - 64 位) DevKit-mingw64-64-4.7.2

Follow instructions here.

按照此处的说明操作。

Or short instructions :

或简短说明:

Unzip the zip

open command-line and go to unzipped folder

ruby dk.rb init

ruby dk.rb install

gem install rdiscount --platform=ruby

解开拉链

打开命令行并转到解压缩的文件夹

ruby dk.rb 初始化

ruby dk.rb 安装

宝石安装 rdiscount --platform=ruby

回答by M.R.Safari

sometimes when you run the ruby dk.rb inityou got an error like this

有时当你运行时你ruby dk.rb init会得到这样的错误

Ruby Error

红宝石错误

for fixing this problem you have to change the encoding of the command prompt windows . to do this type chcp 1256and you will receive this message : Active code page: 1256

要解决此问题,您必须更改命令提示符窗口的编码。执行此类型chcp 1256,您将收到此消息:活动代码页:1256

now you can run that command without problem .

现在您可以毫无问题地运行该命令。

good luck .

祝你好运 。

回答by Ryan Bemrose

If you know that you have the proper DevKit installed (eg: via chocolatey), then you simply need to run the included script to set up environment variables.

如果您知道您安装了正确的 DevKit(例如:通过Chocolatey),那么您只需要运行包含的脚本来设置环境变量。

In cmd:

在 cmd 中:

C:\> d:\path\to\DevKit2\devkitvars.bat

In PowerShell:

在 PowerShell 中:

PS> . d:\path\to\DevKit2\devkitvars.ps1

These scripts will set up the correct paths in your current command window.

这些脚本将在您当前的命令窗口中设置正确的路径。

回答by Akash

Delete the old DevKit folderbefore you extractthe new one which you will download from one of the following links, based on your configuration:

DevKit folder在您之前删除旧的extract,您将从以下之一下载新的links,基于您的configuration

DevKit url at this time For use with Ruby 1.8.7 and 1.9.3: https://github.com/downloads/oneclick/rubyinstaller/DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe

此时的 DevKit url 用于 Ruby 1.8.7 和 1.9.3:https: //github.com/downloads/oneclick/rubyinstaller/DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe

For use with Ruby 2.0 and above (32bits version only): http://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe2

用于 Ruby 2.0 及更高版本(仅限 32 位版本):http: //dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe2

For use with Ruby 2.0 and above (x64 - 64bits only) http://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe3

用于 Ruby 2.0 及更高版本(仅限 x64 - 64 位)http://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe3