views:

65

answers:

2

Hi Folks,

I'm trying to run Rails 3 beta 4 & Ruby 1.9.2rc on Ubuntu 10.04. It worked initially, but after doing my first bundle install/package, I now get the following errors in all rails projects. Even a basic 'rails new testproject' followed by a rake brings up the error messages.

In short, I'm stumped. Any help regarding what could be causing this would be very appreciated.

The only thing I noticed - which may or may not be relevant - is that the directory in the ~/.bundle files is ruby/1.9.1. 1.9.1 is not installed on my machine - only 1.9.2rc. ruby -v brings back 1.9.2

(in /home/john/Websites/sandbox/testerino)
/home/john/.bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:32: warning: already initialized constant RAKEVERSION
/home/john/.bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake/alt_system.rb:32: warning: already initialized constant WINDOWS
WARNING: Possible conflict with Rake extension: String#ext already exists
WARNING: Possible conflict with Rake extension: String#pathmap already exists
/home/john/.bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:404: warning: already initialized constant EMPTY_TASK_ARGS
/home/john/.bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:452: warning: already initialized constant EMPTY
/home/john/.bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:960: warning: already initialized constant RUBY_EXT
/home/john/.bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:964: warning: already initialized constant RUBY
/home/john/.bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:1033: warning: already initialized constant LN_SUPPORTED
/home/john/.bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:1242: warning: already initialized constant ARRAY_METHODS
/home/john/.bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:1245: warning: already initialized constant MUST_DEFINE
/home/john/.bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:1249: warning: already initialized constant MUST_NOT_DEFINE
/home/john/.bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:1253: warning: already initialized constant SPECIAL_RETURN
/home/john/.bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:1259: warning: already initialized constant DELEGATING_METHODS
/home/john/.bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:1569: warning: already initialized constant DEFAULT_IGNORE_PATTERNS
/home/john/.bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:1575: warning: already initialized constant DEFAULT_IGNORE_PROCS
/home/john/.bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:1612: warning: already initialized constant FileList
/home/john/.bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:1638: warning: already initialized constant EARLY
/home/john/.bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:1968: warning: already initialized constant DEFAULT_RAKEFILES
rake aborted!
stack level too deep
+1  A: 

Looks like a strange recursive require.

Did you try uninstalling all versions of rake and reinstalling it? There is a bug in 1.9.2rc affecting gem loading, so that might be it? I didn't look closely into it as many people are already following it closely...

Note: The 1.9.1 is the API version, so it is correct.

Marc-André Lafortune
Does the fact that it was accepted mean it worked?
Marc-André Lafortune
A: 

I've been running into this issue too. It doesn't seem to be related to the specific versions of rails or ruby you mention, which are different than the ones I'm using (Rails 2.3.8, Rake 0.8.7, Ruby 1.9.1p378). It seems to be related to bundler and rake not working well together.

A resolution that worked for me is mentioned at the bottom of this lighthouse ticket. Here is the short version:

  • Run "bundle exec bash"; see if rake works now - if it does,
  • Make sure that the bash environments, before and after, are the same by consulting the env command and modifying ~/.bashrc or ~/.bash_profile accordingly.

Once you do this, you mess up bundler a little bit. At that point you have to clear RUBYOPT in order to run the bundle command:

RUBYOPT= bundle install --relock
Eric W.