3

我在 Windows 7 x64 上,正在尝试从头开始安装 Ruby on Rails。我刚刚安装了RubyInstaller 1.9.3-p429,现在只运行了DevKit-tdm-32-4.5.2-20111229-1559-sfx. 做完之后ruby dk.rb install --force。我试图测试它是否设置正确但遇到:

c:\DevKit>gem install RedCloth --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
The system cannot find the path specified.
ERROR:  Error installing RedCloth:
        ERROR: Failed to build gem native extension.

        C:/Ruby193/bin/ruby.exe extconf.rb
checking for main() in -lc... no
creating Makefile


Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/RedCloth-4.2.9 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/RedCloth-4.2.9/ext/redcloth_scan/gem_make.out

这发生在所有需要 Devkit 的 gem 身上。我想我必须设置指定的路径,但我不知道这意味着什么。我该怎么做或者这里的真正问题是什么?

附言

一点背景。我确实安装了 RailsInstaller,但我遇到了同样的错误,所以我删除了所有内容。我也安装了 NodeJ,但也将其删除。我完全删除了 PATH 变量以从头开始。

更新

尝试 RailsInstaller 会给我这个错误:

$ gem install json -v 1.8.0
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
The system cannot find the path specified.
ERROR:  Error installing json:
        ERROR: Failed to build gem native extension.

        c:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb
creating Makefile


Gem files will remain installed in c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/json-1.8.0 for inspection.
Results logged to c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/json-1.8.0/ext/json/ext/generator/gem_make.out
4

6 回答 6

10

我讨厌碰到一个旧线程,但我希望添加答案以防万一其他人出现(可能因为这是在谷歌搜索“Devkit PATH 错误”的顶部)。

在将 DevKit 解压到永久目录并导航到 shell 中的安装文件夹并输入“ruby dk.rb init”命令后,请确保您确实执行了下一步并安装devkit。在 init 命令之后,运行“ruby dk.rb install”,这应该可以解决许多类似的问题。

于 2014-07-10T04:56:02.380 回答
4

您需要在环境路径中包含 Devkit/bin 目录。首先,找出 Devkit 的安装位置。对于这个例子,我们假设它在C:\Devkit.

接下来打开您的高级系统设置(可在 MyComputer => 属性下访问),然后单击环境变量按钮。在“用户变量”部分下,编辑“路径”条目以包含C:\Devkit\bin. 请注意,此条目以分号分隔,因此您需要在此字符串中添加一个尾随(或前置)分号。

于 2013-06-05T21:28:42.653 回答
2

当我尝试安装 Cucumber 时,我遇到了完全相同的问题,直到我尝试使用该--verbose参数。由于某些原因,这对我有用,但我无法真正解释原因。我不认为它是一种解决方案,但值得一试。

于 2014-01-08T14:44:05.130 回答
1

在这些错误中对我最有效的方法是:https ://github.com/oneclick/rubyinstaller/wiki/Troubleshooting#wiki-gems_fails_comspec_autorun

如果您按照https://github.com/oneclick/rubyinstaller/wiki/Development-Kit#installation-instructions上的标准指南安装了 devkit,那么它不是 Devkit 路径,而是错误的 Autorun 正则表达式键或错误的命令处理器集通过其他干扰 ruby​​ gem 安装的工具。搏一搏。

于 2014-01-10T06:36:51.010 回答
0

我遇到了这个问题,Windows 8 x64,Ruby 2.2.3。

我尝试了许多帖子和许多答案中的所有内容,但只有这对我有用:删除旧的 devkits 并再次安装。

经过这些步骤后,我得到了它的工作:

  1. 删除您曾经安装过 devkit 的每个文件夹

  2. 从http://rubyinstaller.org/downloads/安装(仅限 x64 - 64 位)DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe

  3. 在路径上没有空格或任何内容的地方执行并安装(我做了 c:\devkit)

  4. 转到您的系统环境并添加到路径 c:\devkit 和 c:\devkit\bin

  5. 以管理员身份打开 CMD 提示符,转到 c:\devkit 并键入:

    ruby dk.rb init ruby dk.rb install --force

于 2016-01-04T23:37:39.670 回答
0

https://github.com/oneclick/rubyinstaller/wiki/Troubleshooting#error-failed-to-build-gem-native-extension

这详细说明了可能导致此问题的几种情况。不过,以防万一链接失效。第一个是您的 COMSPEC 系统变量不再具有 cmd.exe 的完整路径。第二个是某种自动运行在注册表中的位置——这是你检查的地方:

REG QUERY "HKCU\Software\Microsoft\Command Processor" /s
REG QUERY "HKLM\Software\Microsoft\Command Processor" /s
REG QUERY "HKCU\Software\Wow6432Node\Microsoft\Command Processor" /s
REG QUERY "HKLM\Software\Wow6432Node\Microsoft\Command Processor" /s

如果您看到任何自动运行,您可以使用以下内容删除它们:

REG DELETE "HKCU\Software\Microsoft\Command Processor" /v AutoRun
于 2016-04-19T20:49:48.007 回答