我试图通过以下命令在我的计算机上安装gem(mechanize):
>> gem install mechanize --platform=ruby
>> gem install mechanize
错误
ERROR: Error installing mechanize:
ERROR: Failed to build gem native extension.
"C:/Program Files/Ruby200-x64/bin/ruby.exe" extconf.rb
C:/Program Files/Ruby200-x64/bin/ruby.exe: invalid switch in RUBYOPT: -F (RuntimeError)
我尝试安装gems(机械化)时显示。并以管理员运行命令行。
我通过以下命令安装了 DevKit (config.xml已被修改原因)
ruby dk.rb init
ruby dk.rb install
有什么方法可以修复此错误吗?提前谢谢。
详细信息可以从截图中找到:
根据Troubleshooting,我从Regedit中移除了AutoRun( HKCU \ Software \ Microsoft \ Command Processor ),但它仍然无法正常工作!
2013/06/03 10:00:26 PM >> REG QUERY "HKCU\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 REG_SZ (if %ANSICON_VER%==^%ANSICON_VER^% "C:\Marslo\Tools\Software\System\CommandLi
icon" -p)&run C:\WINDOWS\autorun.cmd
AutoRun_bak REG_SZ (if %ANSICON_VER%==^%ANSICON_VER^% "C:\Marslo\Tools\Software\System\Comma
\ansicon" -p)&chcp 437&run C:\WINDOWS\autorun.cmd
2013/06/03 10:01:00 PM >> REG QUERY "HKLM\Software\Microsoft\Command Processor" /s
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor
CompletionChar REG_DWORD 0x40
DefaultColor REG_DWORD 0x0
EnableExtensions REG_DWORD 0x1
PathCompletionChar REG_DWORD 0x40
AutoRun REG_SZ %WINDIR%\run.bat
2013/06/03 10:01:05 PM >> REG DELETE "HKCU\Software\Microsoft\Command Processor" /v AutoRun
Delete the registry value AutoRun (Yes/No)? yes
The operation completed successfully.
这里有关于宝石和红宝石的详细信息:
2013/06/03 10:15:46 PM >> gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.3
- RUBY VERSION: 2.0.0 (2013-05-14 patchlevel 195) [x64-mingw32]
- INSTALLATION DIRECTORY: C:/Program Files/Ruby200-x64/lib/ruby/gems/2.0.0
- RUBY EXECUTABLE: "C:/Program Files/Ruby200-x64/bin/ruby.exe"
- EXECUTABLE DIRECTORY: C:/Program Files/Ruby200-x64/bin
- RUBYGEMS PLATFORMS:
- ruby
- x64-mingw32
- GEM PATHS:
- C:/Program Files/Ruby200-x64/lib/ruby/gems/2.0.0
- C:/Users/jiaoolii/.gem/ruby/2.0.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
答案 0 :(得分:16)
我找到了原因。仅仅因为Ruby
的安装路径中存在空间RUBY EXECUTABLE: "C:/Program Files/Ruby200-x64/bin/ruby.exe"
将Ruby重新安装到不包含空格的路径,此错误将被修复。
当然,AutoRun
应从HKCU\Software\Microsoft\Command Processor
和HKLM\Software\Microsoft\Command Processor
中删除。
这很重要!