简体   繁体   中英

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)

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

any hints?, thanks

There's now an entry in the RubyInstaller Wiki that addresses this potential issue:

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.

If the above answer by Ryan Barton didn't work, then try this. It was also pulled from the 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 must contain a full path to the cmd.exe executable and relative paths will fail.

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

The non-processed variable (that you will find inside System Properties - Environment variables) is: %SystemRoot%\\system32\\cmd.exe

Change that and try to install the gem again.

Hmm, my RubyInstaller + DevKit installation worked fine on the first try. So a couple ideas:

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.)

2.) Are you sure that the DevKit is 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.

(...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.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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