(转)ERROR: Failed to build gem native extension

简介:   这几天本人在Window server 2003(工作机)中搭建Cucumber环境时(可以看我的另一篇文章:http://www.cnblogs.com/puresoul/archive/2011/11/18/2254407.html),当运行gem install cucumber时,报错:ERROR: Failed to build gem native extension.到处搜寻未果,最后在这里找到了答案:https://github.com/oneclick/rubyinstaller/wiki/Troubleshooting,特此转来。

  这几天本人在Window server 2003(工作机)中搭建Cucumber环境时(可以看我的另一篇文章:http://www.cnblogs.com/puresoul/archive/2011/11/18/2254407.html),当运行gem install cucumber时,报错:ERROR: Failed to build gem native extension.到处搜寻未果,最后在这里找到了答案:https://github.com/oneclick/rubyinstaller/wiki/Troubleshooting,特此转来。本人就不做翻译了,有需要的朋友尽管拿去,原文如下:

  You’ve installed both RubyInstaller and DevKit following the instructions but during gem installation, you receive a message like this:

C:\devkit>gem install rdiscount --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing rdiscount:
       ERROR: Failed to build gem native extension.

C:/ruby/bin/ruby.exe extconf.rb
C:/ruby/bin/ruby.exe: No such file or directory -- extconf.rb
(LoadError)

Or sometimes just this:

ERROR: Error installing rdiscount: 
ERROR: Failed to build gem native extension. 
C:/Ruby187/bin/ruby.exe extconf.rb

This has been reported to our group here and here.

After a long back and forth investigation, we found two possible causes for this issue: COMSPEC environment variable (scenario A) and AutoRun registry setting (scenario B), both described below:

Scenario A

Using a command prompt, invoke the following command:

SET COMSPEC

If in the output you see something different than cmd.exe as value for that variable, then please adjust it to use cmd.exe

Some tools might change your command processor command, which interferes with Ruby invoking child processes.

Change that and try to install the gem again.

Scenario B

If the problem persist, invoke the following commands in the same command prompt:

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.

目录
相关文章
|
5月前
|
缓存 资源调度 JavaScript
server error: Preprocessor dependency “less“ not found. Did you install it?
server error: Preprocessor dependency “less“ not found. Did you install it?
106 0
|
iOS开发
编译OpenJDK8报错:configure: error: Failed to determine Xcode version.
编译OpenJDK8报错:configure: error: Failed to determine Xcode version.
93 0
|
计算机视觉
CMake Warning at cmake/OpenCVDownload.cmake:202 (message): IPPICV: Download failed: 28;“Timeout
CMake Warning at cmake/OpenCVDownload.cmake:202 (message): IPPICV: Download failed: 28;“Timeout
605 0
CMake Warning at cmake/OpenCVDownload.cmake:202 (message): IPPICV: Download failed: 28;“Timeout
|
Java iOS开发
Mac编译OpenJDK8:configure: error: Xcode 4 is required to build JDK 8, the version found was 10.1config
Mac编译OpenJDK8:configure: error: Xcode 4 is required to build JDK 8, the version found was 10.1config
96 0
【解决方案】成功解决ERROR: Could not build wheels for opencv-python, which is required to install pyproject.toml-based projects报错信息
成功解决ERROR: Could not build wheels for opencv-python, which is required to install pyproject.toml-based projects报错信息
【解决方案】成功解决ERROR: Could not build wheels for opencv-python, which is required to install pyproject.toml-based projects报错信息
|
开发工具
Unknown error: Unable to build: the file dx.jar was not loaded from the SDK folder!
Unknown error: Unable to build: the file dx.jar was not loaded from the SDK folder!
91 0
|
开发工具
Failed to find Build Tools revision 25.0.2
Failed to find Build Tools revision 25.0.2
81 0
codeblocks中出现#error This file requires compiler and library support for the错误时的解决方案
codeblocks中出现#error This file requires compiler and library support for the错误时的解决方案
478 0
codeblocks中出现#error This file requires compiler and library support for the错误时的解决方案
编译OpenJDK8:configure: error: Could not find all X11 headers
编译OpenJDK8:configure: error: Could not find all X11 headers
130 0
|
资源调度 JavaScript 前端开发
yarn打包报错:error during build: Error: Assigning to rvalue (Note that you need plugins to import files
yarn打包报错:error during build: Error: Assigning to rvalue (Note that you need plugins to import files
256 7