Cannot Freeze gems - uninitialized constant Gem::GemRunner

I’m running Rails 1.99.0.8178

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:inrequire’
D:/Development/RailsApps/Quiz/config/boot.rb:45:in load_initializer' D:/Development/RailsApps/Quiz/config/boot.rb:38:inrun’
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:ingem_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:inload’
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:inload_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:inload_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:instandard_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:inload’
c:/ruby/bin/rake:19

Will M. wrote:

I’m running Rails 1.99.0.8178

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

What version of rake? What version of Gem?

James B. wrote:

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?

James B. wrote:

Will M. wrote:

I’m running Rails 1.99.0.8178

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

What version of rake? What version of Gem?

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.

James B. wrote:

Will M. wrote:

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

Will M. wrote:

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

James B. wrote:

What is the code at and around line 27 in:

c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb

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?

Will M. wrote:

c:\ruby\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;

OK. Now let us see what is in ‘$:’. (Use ‘puts $:’ in place of ‘puts
path’.

James B. wrote:

Will M. wrote:

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’?

James B. wrote:

James B. wrote:

What is the code at and around line 27 in:

c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb

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;

James B. wrote:

James B. wrote:

Will M. wrote:

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:

Will M. wrote:

James B. wrote:

Will M. wrote:

c:\ruby\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;

OK. Now let us see what is in ‘$:’. (Use ‘puts $:’ in place of ‘puts
path’.

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.

James B. wrote:

Will M. wrote:

c:\ruby\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;

OK. Now let us see what is in ‘$:’. (Use ‘puts $:’ in place of ‘puts
path’.

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

James B. wrote:

James B. wrote:

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.

Will M. wrote:

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?

Will M. schrieb:

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.

in /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

James B. wrote:

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.

You would not happen to have this environment variable set, would you?

RUBY_FRAMEWORK_VERSION

I already started rebuilding my dev environemnt. The thing is another
co-worker is having the same problem.

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.

Will M. wrote:

James B. wrote:

You would not happen to have this environment variable set, would you?

RUBY_FRAMEWORK_VERSION

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?