windows 无法构建 gem 本机扩展 - 找不到 extconf.rb
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3018166/
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
Failed to build gem native extension - extconf.rb not found
提问by george
When trying to install
尝试安装时
'bcrypt-ruby', :lib => 'bcrypt'
and
和
'hpricot'
I get this in both cases (Using Windows XP)
我在这两种情况下都得到了这个(使用 Windows XP)
C:/Ruby/bin/ruby.exe: No such file or directory -- extconf.rb (LoadError)
I installed from here http://rubyinstaller.org/downloads/Rb 1.8.6, including the devkit
我从这里安装了http://rubyinstaller.org/downloads/Rb 1.8.6,包括 devkit
any hints?, thanks
有什么提示吗,谢谢
回答by Ryan Barton
There's now an entry in the RubyInstaller Wikithat addresses this potential issue:
现在RubyInstaller Wiki中有一个条目解决了这个潜在问题:
Using a command prompt, invoke the following commands:
REG QUERY "HKCU\Software\Microsoft\Command Processor" REG QUERY "HKLM\Software\Microsoft\Command Processor"
Execute each line individually. Once you run it, will see something like this:
HKEY_CURRENT_USER\Software\Microsoft\Command Processor CompletionChar REG_DWORD 0x9 DefaultColor REG_DWORD 0x0 EnableExtensions REG_DWORD 0x1 PathCompletionChar REG_DWORD 0x9
The columns of information are Key, Type and Value. If you see a key named AutoRun, there is a chance this is the culprit of the error you're receiving. AutoRun interferes with Ruby messing with child process executing and by result, affecting gem installation. Please remove it with the following command:
REG DELETE "HKCU\Software\Microsoft\Command Processor" /v AutoRun
Once you're done, try opening a new command prompt and executing gem installation again.
使用命令提示符调用以下命令:
REG QUERY "HKCU\Software\Microsoft\Command Processor" REG QUERY "HKLM\Software\Microsoft\Command Processor"
单独执行每一行。一旦你运行它,会看到这样的东西:
HKEY_CURRENT_USER\Software\Microsoft\Command Processor CompletionChar REG_DWORD 0x9 DefaultColor REG_DWORD 0x0 EnableExtensions REG_DWORD 0x1 PathCompletionChar REG_DWORD 0x9
信息列是键、类型和值。如果您看到名为 AutoRun 的键,则这可能是您收到错误的罪魁祸首。AutoRun 会干扰 Ruby 干扰子进程的执行和结果,从而影响 gem 安装。请使用以下命令删除它:
REG DELETE "HKCU\Software\Microsoft\Command Processor" /v AutoRun
完成后,尝试打开一个新的命令提示符并再次执行 gem 安装。
回答by ewall
Hmm, my RubyInstaller + DevKit installation worked fine on the first try. So a couple ideas:
嗯,我的 RubyInstaller + DevKit 安装在第一次尝试时运行良好。所以有几个想法:
1.) Did you start Gem from the shortcut entitled "Start Command Prompt with Ruby"? (This will ensure that the correct paths and such are included.)
1.) 您是从名为“使用 Ruby 启动命令提示符”的快捷方式启动 Gem 的吗?(这将确保包含正确的路径等。)
2.) Are you sure that the DevKitis installed correctly? Both of those gems do include the extconf.rb file, but Gem will still choke if the expected development tools are not immediately available.
2.) 你确定DevKit安装正确吗?这两个 gem 都包含extconf.rb 文件,但是如果预期的开发工具没有立即可用,Gem 仍然会阻塞。
(...Otherwise, the RubyInstall mailing listmight be the best place to seek help for this--or the gem's author, but it appears that he doesn't "do" Windows.)
(...否则,RubyInstall 邮件列表可能是为此寻求帮助的最佳地点——或 gem 的作者,但他似乎不“做”Windows。)
回答by Butch Mayhew
If the above answer by Ryan Bartondidn't work, then try this. It was also pulled from the RubyInstaller Wiki
如果Ryan Barton的上述答案不起作用,请尝试此操作。它也是从RubyInstaller Wiki 中提取的
Using a command prompt, invoke the following command:
使用命令提示符调用以下命令:
SET COMSPEC
The default output of that should look like:
其默认输出应如下所示:
ComSpec=C:\Windows\system32\cmd.exe
If in the output includes something different than cmd.exe as executable, then please adjust it to use cmd.exe. Please note that the variable mustcontain a full path to the cmd.exe executable and relative paths will fail.
如果在输出中包含不同于 cmd.exe 的可执行文件,请调整它以使用 cmd.exe。请注意,变量必须包含 cmd.exe 可执行文件的完整路径,相对路径将失败。
Some tools might change your command processor command, which interferes with Ruby invoking child processes.
某些工具可能会更改您的命令处理器命令,这会干扰 Ruby 调用子进程。
The non-processed variable (that you will find inside System Properties - Environment variables) is: %SystemRoot%\system32\cmd.exe
未处理的变量(您将在系统属性 - 环境变量中找到)是: %SystemRoot%\system32\cmd.exe
Change that and try to install the gem again.
更改它并尝试再次安装 gem。