简体   繁体   English

无法构建gem native扩展 - 找不到extconf.rb

[英]Failed to build gem native extension - extconf.rb not found

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 任何提示?谢谢

There's now an entry in the RubyInstaller Wiki that 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的密钥,则可能是您收到的错误的罪魁祸首。 AutoRun interferes with Ruby messing with child process executing and by result, affecting gem installation. AutoRun干扰Ruby搞乱子进程执行和结果,影响gem安装。 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. 完成后,尝试打开新的命令提示符并再次执行gem安装。

If the above answer by Ryan Barton didn't work, then try this. 如果Ryan Barton的上述答案不起作用,那就试试吧。 It was also pulled from the RubyInstaller Wiki 它也是从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. 如果输出中包含与cmd.exe不同的可执行文件,请将其调整为使用cmd.exe。 Please note that the variable must contain a full path to the cmd.exe executable and relative paths will fail. 请注意,该变量必须包含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。

Hmm, my RubyInstaller + DevKit installation worked fine on the first try. 嗯,我的RubyInstaller + DevKit安装在第一次尝试时运行良好。 So a couple ideas: 所以有几个想法:

1.) Did you start Gem from the shortcut entitled "Start Command Prompt with Ruby"? 1.)您是否从名为“使用Ruby启动命令提示符”的快捷方式启动Gem? (This will ensure that the correct paths and such are included.) (这将确保包含正确的路径等。)

2.) Are you sure that the DevKit is installed correctly? 2.)你确定DevKit安装正确吗? Both of those gems do include the extconf.rb file , but Gem will still choke if the expected development tools are not immediately available. 这两个宝石都包含extconf.rb文件 ,但如果预期的开发工具不能立即使用,Gem仍会阻塞。

(...Otherwise, the RubyInstall mailing list might be the best place to seek help for this--or the gem's author, but it appears that he doesn't "do" Windows.) (...否则, RubyInstall邮件列表可能是寻求帮助的最佳位置 - 或者宝石的作者,但看起来他并没有“做”Windows。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM