Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uninitialized constant ActiveSupport::Dependencies::Mutex

I try to run a working rails project from OSX to Debian. I use on both systems RVM and created the same gemsets and rvmrc for the project. On Debian I installed only ruby with rvm no system installation of ruby exists.

when I jump in the project folder rvm is switching to version 1.8.7 and is using the project gemset everything looks fine.

But when I fire up a rake -T I get this error:

$ rake -T --trace
(in /home/i/project/src)
rake aborted!
uninitialized constant ActiveSupport::Dependencies::Mutex
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rake-0.8.7/lib/rake.rb:2503:in `const_missing'
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:55
/home/i/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/home/i/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/activesupport-2.3.5/lib/active_support.rb:56
/home/i/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/home/i/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rails-2.3.5/lib/tasks/misc.rake:18
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rails-2.3.5/lib/tasks/rails.rb:4:in `load'
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rails-2.3.5/lib/tasks/rails.rb:4
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rails-2.3.5/lib/tasks/rails.rb:4:in `each'
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rails-2.3.5/lib/tasks/rails.rb:4
/home/i/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/home/i/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/home/i/ws/project/src/Rakefile:10
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rake-0.8.7/lib/rake.rb:2383:in `load'
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile'
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rake-0.8.7/lib/rake.rb:2017:in `load_rakefile'
/    home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile'
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rake-0.8.7/lib/rake.rb:2000:in `run'
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rake-0.8.7/bin/rake:31
/home/i/.rvm/gems/ruby-1.8.7-p249@project/bin/rake:19:in `load'
/home/i/.rvm/gems/ruby-1.8.7-p249@project/bin/rake:19
like image 606
haubentaucher23 Avatar asked Apr 06 '11 09:04

haubentaucher23


3 Answers

For me, adding require 'thread' didn't work either. The problem was solved by downgrading rubygems to 1.4.2:

It's a compatibility issue between newer versions of rubygems (in my case, 1.8.5) and old versions of rails (in my case 2.3.5)

$ gem install rubygems-update -v='1.4.2'

$ gem uninstall rubygems-update -v='1.8.5'

$ update_rubygems
like image 199
Diego Alvarez Correia Avatar answered Nov 19 '22 12:11

Diego Alvarez Correia


My working solution. Add the following line:

require 'thread'

At the first line of Rakefile in your rails project root. And magically all will run ;-)

like image 13
Dynamick Avatar answered Nov 19 '22 12:11

Dynamick


I ran into this myself not too long ago. If you google for it you'll find a couple of blog and mailing list posts advising you to explicitly require "threads" in your environment.rb. However this did not work for me, but downgrading rubygems did:

sudo gem update --system 1.3.7

Some of the posts also mention upgrading to a newer version of Rails, which was not an option in our case at the moment.

like image 7
Michael Kohl Avatar answered Nov 19 '22 13:11

Michael Kohl