The error "invalid switch in RUBYOPT: -F (RuntimeError)" is displayed when installing gems using the gem install mechanize method

I am trying to install gem (mechanize) on my computer by running the following commands:

>> gem install mechanize --platform=ruby >> gem install mechanize 

Error

 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) 

displayed when I try to set gems (mechanize). And run the command prompt as Administrator .

I installed DevKit using the commands below (config.xml was changed due to a reason)

 ruby dk.rb init ruby dk.rb install 

Is there any way to fix this error? Thanks in advance.

Here is the OS information:

  • OS Version: Win7 64bit
  • Ruby version: 2.0.0p195 x64
  • DevKit Version: DevKit-mingw64-64-4.7.2-20130224-1432-sfx
  • GEM Version: 2.0.3
  • Ruby Installation Location: C: / Program Files / Ruby200-x64

Details can be found in the screenshot: enter image description here

According to Troubleshooting , I will remove AutoRun from Regedit ( HKCU \ Software \ Microsoft \ Command Processor ), but it still cannot work!

 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. 

Details about gems and rubies:

 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/ 
+6
source share
1 answer

I have found a reason. Just because the Ruby installation path

there is a space
 RUBY EXECUTABLE: "C:/Program Files/Ruby200-x64/bin/ruby.exe" 

Reinstall Ruby on a path that does not contain a space, this error will be fixed.


And, of course, AutoRun should be removed from HKCU\Software\Microsoft\Command Processor and HKLM\Software\Microsoft\Command Processor .

It is important!

+16
source

Source: https://habr.com/ru/post/946410/


All Articles