I had Ruby-on-Rails installed, but it was Ruby version 1.9.3. It was installed via the Railsinstaller. Since I am just starting in RoR, I wanted to start with the most updated versions to go through the Ruby on Rails Tutorial. Rails was easy enough to update, but not Ruby itself.
I uninstalled the existing RailsInstaller, deleted the c:\Railsinstaller directory and downloaded the latest version of RailsInstaller, version 3.0.0-alpha.1.
Upon install it launches a command prompt window that should list the install infor for git, ruby and rails. Instead I got this error:
The system cannot find the path specified.
Rails Environment Configuration.
C:/RailsInstaller/scripts/config_check.rb:28:in ``': No such file or directory -
rails -v (Errno::ENOENT)
from C:/RailsInstaller/scripts/config_check.rb:28:in `run'
from C:/RailsInstaller/scripts/config_check.rb:83:in `<main>'
C:\Sites>
Line 28 is part of this block:
def run(command)
$stderr.puts "Running #{command}" if Config[:debug]
%x{#{command}}.chomp
end
and line 83 is this inside of a 'puts' block:
version: #{run "rails -v"}
manually running "rails -v"
C:\Sites>rails -v
'rails' is not recognized as an internal or external command,
operable program or batch file.
attempting "ruby rails.rb" ruby: No such file or directory -- rails.rb (LoadError)
attempting to manually install the rails gem
c:\Sites>gem install rails --version 4.0.0
Fetching: i18n-0.6.4.gem (100%)
Successfully installed i18n-0.6.4
Fetching: atomic-1.1.10.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
The system cannot find the path specified.
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
C:/RailsInstaller/Ruby2.0.0/bin/ruby.exe extconf.rb
creating Makefile
Gem files will remain installed in C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0
.0/gems/atomic-1.1.10 for inspection.
Results logged to C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/atomic-1.
1.10/ext/gem_make.out
The gem_make.out only contains:
C:/RailsInstaller/Ruby2.0.0/bin/ruby.exe extconf.rb
creating Makefile
I attempted to install Railsinstaller 3.0.0 on a windows xp machine to test, and got the same error after the install, running "rails -v" failed in the same way, but running "gem install rails --version 4.0.0" worked.
Did something persist from the previous install that is preventing the new install from functioning properly?
I think something is still trying to go to the Ruby1.9.3 forlder and/or subfolders and failing, but can't find anything referencing that directory.
After a bunch of additional research and out side help, found this:
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" /s
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.
Scenario B ended up being the culprit and things began working properly once that was completed.