When I try
# rake rails:freeze:gems
I get the error:
(in D:/Development/RailsApps/Quiz)
Freezing to the gems for Rails 1.99.0.8178
rake aborted!
uninitialized constant Gem::GemRunner
Below includes --trace:
rake aborted!
no such file to load --
D:/Development/RailsApps/Quiz/config/../vendor/rails/railties/lib/initialize
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
D:/Development/RailsApps/Quiz/config/boot.rb:45:in `load_initializer'
D:/Development/RailsApps/Quiz/config/boot.rb:38:in `run'
D:/Development/RailsApps/Quiz/config/boot.rb:11:in `boot!'
D:/Development/RailsApps/Quiz/config/boot.rb:108
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
D:/Development/RailsApps/Quiz/rakefile:4
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1940:in `load'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1940:in
`raw_load_rakefile'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1727:in
`load_rakefile'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1761:in
`standard_exception_handling'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1726:in
`load_rakefile'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1710:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1761:in
`standard_exception_handling'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1708:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/bin/rake:7
c:/ruby/bin/rake:19:in `load'
c:/ruby/bin/rake:19
--
Posted via http://www.ruby-forum.com/.
What version of rake? What version of Gem?
> What version of rake? What version of Gem?
Ahh. Is see on closer inspection that rake is 0.7.3. What is the version
of gem however?
gem 0.9.5
rails 1.99.0
ruby 1.8.6
How do I get the version of rake? rake -v throws an error for me.
Your rake is 0.7.3 as is revealed by the trace. What is the code at and
around line 27 in:
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb
Starting with line 26:
def require(path) # :nodoc:
gem_original_require path
rescue LoadError => load_error
if load_error.message =~ /\A[Nn]o such file to load --
#{Regexp.escape path}\z/ and
spec = Gem.searcher.find(path) then
Gem.activate(spec.name, false, "= #{spec.version}")
gem_original_require path
else
raise load_error
end
end
Mine says this:
26 def require(path) # :nodoc:
27 gem_original_require path
28 rescue LoadError => load_error
29 if load_error.message =~ /\A[Nn]o such file to load --
#{Regexp.escape p
30 spec = Gem.searcher.find(path) then
31 Gem.activate(spec.name, false, "= #{spec.version}")
32 gem_original_require path
33 else
34 raise load_error
So it looks as if the path variable/method is returning an invalid file
or path name. You can insert "puts path" after line 26 and see what
that value is. That make give a clue as to what is going on. Perhaps,
as this is a windows machine, you are missing an entry in your system
PATH environment variable?
puts path spits out:
rubygems
etc
fileutils
fileutils
rbconfig
ftools
getoptlong
fileutils
singleton
thread
ostruct
rake
Do you have any idea what entry I'm missing in my PATH environment
variable? Ruby is there:
c:\ruby\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;
> c:\ruby\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;
OK. Now let us see what is in '$:'. (Use 'puts $:' in place of 'puts
path'.
And, now that I think of it, what do you get from running 'gem
environment'?
rubygems
timeout
optparse
rubygems/user_interaction
rubygems/command
rubygems/user_interaction
rubygems/command_manager
stringio
yaml/error
syck
yaml/ypath
yaml/basenode
yaml/syck
yaml/tag
yaml/stream
yaml/constants
rational
date/format
date
yaml/rubytypes
yaml/types
yaml
rubygems
rubygems/config_file
etc
fileutils
rubygems/doc_manager
rubygems/gem_runner
rubygems/command
rubygems/commands/environment_command
fileutils
fileutils
RubyGems Environment:
- RUBYGEMS VERSION: 0.9.5 (0.9.5)
- RUBY VERSION: 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
- INSTALLATION DIRECTORY: c:/ruby/lib/ruby/gems/1.8
- RUBY EXECUTABLE: c:/ruby/bin/ruby.exe
- RUBYGEMS PLATFORMS:
- ruby
- x86-mswin32-60
- GEM PATHS:
- c:/ruby/lib/ruby/gems/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://gems.rubyforge.org
c:/ruby/lib/ruby/site_ruby/1.8
c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt
c:/ruby/lib/ruby/site_ruby
c:/ruby/lib/ruby/1.8
c:/ruby/lib/ruby/1.8/i386-mswin32
.
c:/ruby/lib/ruby/site_ruby/1.8
c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt
c:/ruby/lib/ruby/site_ruby
c:/ruby/lib/ruby/1.8
c:/ruby/lib/ruby/1.8/i386-mswin32
.
c:/ruby/lib/ruby/site_ruby/1.8
c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt
c:/ruby/lib/ruby/site_ruby
c:/ruby/lib/ruby/1.8
c:/ruby/lib/ruby/1.8/i386-mswin32
.
c:/ruby/lib/ruby/site_ruby/1.8
c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt
c:/ruby/lib/ruby/site_ruby
c:/ruby/lib/ruby/1.8
c:/ruby/lib/ruby/1.8/i386-mswin32
.
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/bin
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib
c:/ruby/lib/ruby/site_ruby/1.8
c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt
c:/ruby/lib/ruby/site_ruby
c:/ruby/lib/ruby/1.8
c:/ruby/lib/ruby/1.8/i386-mswin32
.
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/bin
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib
c:/ruby/lib/ruby/site_ruby/1.8
c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt
c:/ruby/lib/ruby/site_ruby
c:/ruby/lib/ruby/1.8
c:/ruby/lib/ruby/1.8/i386-mswin32
.
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/bin
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib
c:/ruby/lib/ruby/site_ruby/1.8
c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt
c:/ruby/lib/ruby/site_ruby
c:/ruby/lib/ruby/1.8
c:/ruby/lib/ruby/1.8/i386-mswin32
.
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/bin
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib
c:/ruby/lib/ruby/site_ruby/1.8
c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt
c:/ruby/lib/ruby/site_ruby
c:/ruby/lib/ruby/1.8
c:/ruby/lib/ruby/1.8/i386-mswin32
.
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/bin
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib
c:/ruby/lib/ruby/site_ruby/1.8
c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt
c:/ruby/lib/ruby/site_ruby
c:/ruby/lib/ruby/1.8
c:/ruby/lib/ruby/1.8/i386-mswin32
.
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/bin
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib
c:/ruby/lib/ruby/site_ruby/1.8
c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt
c:/ruby/lib/ruby/site_ruby
c:/ruby/lib/ruby/1.8
c:/ruby/lib/ruby/1.8/i386-mswin32
.
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/bin
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib
c:/ruby/lib/ruby/site_ruby/1.8
c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt
c:/ruby/lib/ruby/site_ruby
c:/ruby/lib/ruby/1.8
c:/ruby/lib/ruby/1.8/i386-mswin32
.
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/bin
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib
c:/ruby/lib/ruby/site_ruby/1.8
c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt
c:/ruby/lib/ruby/site_ruby
c:/ruby/lib/ruby/1.8
c:/ruby/lib/ruby/1.8/i386-mswin32
I do not seem to see anything like 'c:/ruby/lib/ruby/gems/1.8' do you?
It seems to me that the system environment variables GEM_HOME and
GEM_PATH should have entries like:
GEM_HOME = c:/ruby/lib/ruby/gems/1.8
GEM_PATH = c:/ruby/lib/ruby/gems/1.8
I am not on a windows machine at the moment but you can try adding these
two environment variables and their settings to your user profile and
see if that works. If it does then it will get you going, but you
should raise this issue on the rubyforge forum devoted to gem:
(http://rubyforge.org/forum/forum.php?forum_id=14655)
In any case, this is a temporary fix (if it works at all) and will break
on the next minor version update of ruby so remember it.
I hope that this helps because I am out of ideas for now.
> I do not seem to see anything like 'c:/ruby/lib/ruby/gems/1.8' do you?
>
> It seems to me that the system environment variables GEM_HOME and
> GEM_PATH should have entries like:
> GEM_HOME = c:/ruby/lib/ruby/gems/1.8
> GEM_PATH = c:/ruby/lib/ruby/gems/1.8
>
You may also try 'c:/ruby/lib/ruby/gems/1.8/gems' if the above does not
work.
None of these solutions work.
I might just go back to 1.2.6.
Hmmm...
(in D:/Development/RailsApps/Quiz)
Freezing to the gems for Rails 1.99.0.8178
rake aborted!
uninitialized constant Gem::GemRunner
The problem here is that GemRunner is not a constant, it is a class
defined in:
lib/ruby/gems/1.8/gems/rubygems-update-0.9.5/lib/rubygems/gem_runner.rb
which does not seem to be called, thus the uninitialized constant error.
There is definitely something borked in the search paths but where the
problem originates I do not know. Have you tried doing a gem cleanup
and re-running rake?
in <rubygems>/rails/lib/tasks/framework.rake you have the rails:freeze:gems
task. After "require 'rubygems'" add the following line:
require 'gem_runner'
Since Gems 0.9.5 the Runner isn't required automatically.
Cheers
Florian
RUBY_FRAMEWORK_VERSION
So once I rebuild, I'll try freezing again, if that fails I'll catch up
to your latest suggestions. Thanks for the help so far, I'll post the
results soon.
No but I do have this set:
RAILS_GEM_VERSION = '>= 1.99' unless defined? RAILS_GEM_VERSION
And what does boot.rb set this to?
As far as I can tell it is setting it to however it is defined in
environment.rb
rescue Gem::LoadError => load_error
$stderr.puts %(Missing the Rails #{version} gem. Please `gem
install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in
config/environment.rb for the Rails version you do have installed, or
comment out RAILS_GEM_VERSION to use the latest version installed.)
exit 1
end
class << self
def rubygems_version
Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion
end
def gem_version
if defined? RAILS_GEM_VERSION
RAILS_GEM_VERSION
elsif ENV.include?('RAILS_GEM_VERSION')
ENV['RAILS_GEM_VERSION']
else
parse_gem_version(read_environment_rb)
end
end
Installed
ruby 1.8.6-25
rubygems 0.9.5
gem install rails --include-dependencies
I'm now running rails 1.2.6
Create application:
# rails foo
Attempt to freeze gems:
D:\Development\Foo>rake rails:freeze:gems --trace
(in D:/Development/Foo)
** Invoke rails:freeze:gems (first_time)
** Execute rails:freeze:gems
Freezing to the gems for Rails 1.2.6
rake aborted!
uninitialized constant Gem::GemRunner
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:2028:in
`const_missing'
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/tasks/framework.rake:26
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/tasks/framework.rake:25:in
`each'
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/tasks/framework.rake:25
c:/ruby/lib/ruby/1.8/fileutils.rb:121:in `chdir'
c:/ruby/lib/ruby/1.8/fileutils.rb:121:in `chdir'
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/tasks/framework.rake:24
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `call'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `execute'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `each'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `execute'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:362:in `invoke'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in
`synchronize'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in `invoke'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:in
`top_level'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:in `each'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:in
`top_level'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1761:in
`standard_exception_handling'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1733:in
`top_level'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1711:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1761:in
`standard_exception_handling'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1708:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/bin/rake:7
c:/ruby/bin/rake:16:in `load'
c:/ruby/bin/rake:16
So I'm going to update framework.rake with require 'gem_runner'.
> As far as I can tell it is setting it to however it is defined in
> environment.rb
>
In config/boot.rb you can insert these two lines around line 11:
rails_gem_version =
if defined? RAILS_GEM_VERSION
puts "boot.rb #{RAILS_GEM_VERSION}" #<--- insert
RAILS_GEM_VERSION
else
puts "boot.rb RAILS_GEM_VERSION not defined" #<--- insert
File.read("#{File.dirname(__FILE__)}/environment.rb") =~
/^[^#]*RAILS_GEM_VERSION\s+=\s+'([\d.]+)'/
$1
end
and in config/environment.rb you can put this:
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '1.2.5' unless defined? RAILS_GEM_VERSION
puts "environment.rb RAILS_GEM_VERSION #{RAILS_GEM_VERSION}" #<---
insert
Then run script/server and see if that shows anything odd.
$ script/server
script/server
boot.rb RAILS_GEM_VERSION not defined
environment.rb RAILS_GEM_VERSION 1.2.5
What's confusing is the "no such file to load -- "
So this is exactly what other people in my office are getting to. I
don't understand how we can all be getting this error yet I don't see
any other problems when searching for the same error. And, we were all
running fine not too long ago. Can't figure out what changed.
D:\Development\Foo>rake rails:freeze:gems --trace
(in D:/Development/Foo)
rake aborted!
no such file to load --
D:/Development/Foo/config/../vendor/rails/railties/lib/initializer
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
D:/Development/ScribeStorm/Foo/config/boot.rb:7
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
D:/Development/ScribeStorm/Foo/rakefile:4
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1940:in `load'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1940:in
`raw_load_rakefile'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1727:in
`load_rakefile'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1761:in
`standard_exception_handling'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1726:in
`load_rakefile'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1710:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1761:in
`standard_exception_handling'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1708:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/bin/rake:7
c:/ruby/bin/rake:16:in `load'
c:/ruby/bin/rake:16
Just go this, trying now . ..
I get this:
D:\Development\Foo>ruby script\server
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require': no such file to load --
./script/../config/../vendor
/rails/railties/lib/initializer (LoadError)
from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
from ./script/../config/boot.rb:7
from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
from script/server:2
I will look at this again tonight. I do not have anything useful to
suggest at the moment.
I'm now on 0.9.4 and everything seems to work as it should. This makes
sense since 0.9.5 was released on the 19th, right before different
developers in the office started having trouble.
Note: the ruby 1.8.6 installer allows you select to install rubygems as
well. I did not try that, but rather installed ruby 1.8.6, then
rubygems 0.9.4. Then Rails.
Will Merydith schrieb:
In ruby\lib\gems\1.8\gems\rails-2.0.1\lib\tasks\framework.rake:
[original]
line 6: require 'rubygems'
[my fix]
line 6: require 'rubygems'
line 7: require 'rubygems/gem_runner'
And as Florian mentioned, make sure to delete the rails directory in
vendor/ if it exists.
That does not (did not) solve the problem for anyone in this office.
Perfect, this solved my problem - I had originally just used `require
'gem_runner'` but just needed to prefix it with `rubygems/`...derrr
Thanks, Nelson