Fixing "uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)"

If you have to work with older versions of Rails, there might be discrepancy between the versions of Rails and Rubygems. Theats when you likely see the below message when you try to boot your rails app.

/home/lt-pc-528/.rvm/gems/ruby-1.8.7-p371/gems/activesupport-2.3.7/lib/active_support/dependencies.rb:55:
uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)
.....
......

You can fix the error by adding the following to environment.rb and script/server.rb files before you require boot.rb file.

require 'thread'

If you still get the error, try adding the same in your boot.rb file after RAILS_ROOT constant was defined.

You will get a stack of warning messages and whats important is your rails app starts without issues :)

Sandheep About 11 years ago