未初始化的常量ActiveSupport :: Dependencies :: Mutex(NameError) - 如何解决?

时间:2011-10-22 21:50:47

标签: ruby-on-rails rubygems rvm

  

可能重复:
  Uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)

嘿,我在网上看到了很多这个问题......任何人都能解决这个问题吗?

我的应用是RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION

日志输出

/Users/tjs/.rvm/gems/ruby-1.8.7-p352@rails2/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:55: uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)
from /Users/tjs/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:55:in `gem_original_require'
from /Users/tjs/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:55:in `require'
from /Users/tjs/.rvm/gems/ruby-1.8.7-p352@rails2/gems/activesupport-2.3.5/lib/active_support.rb:56
from /Users/tjs/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:55:in `gem_original_require'
from /Users/tjs/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:55:in `require'
from /Users/tjs/.rvm/gems/ruby-1.8.7-p352@rails2/gems/rails-2.3.5/lib/commands/server.rb:1
from /Users/tjs/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:55:in `gem_original_require'
from /Users/tjs/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:55:in `require'
from script/server:4

我已经尝试在environment.rb,script / sever和rakefile中要求线程,但这只会炸毁日志......

我有使用1.8.7的rvm我认为是兼容的。但我还是比rvm更新,所以不能完全确定我的工作正常。

我有3个运行rails 2.x的应用程序,并且所有这些都有这个问题。

4 个答案:

答案 0 :(得分:4)

http://ecmanaut.blogspot.com/2011/09/running-old-rails-238-with-rvm.html按照这些步骤操作,应用再次运行。

感谢所有帖子

答案 1 :(得分:3)

将“require'thread'”语句添加到“boot.rb”文件中。

require 'thread'
require File.join(File.dirname(__FILE__), 'boot')

答案 2 :(得分:1)

你只需要使用rbenv https://github.com/jamis/rbenv-gemset或rvm使用一个新的gemset并安装一个rubygems-update 1.4.2

gem install -v 1.4.2 rubygems-update
gem update --system 1.4.2

欢呼声

答案 3 :(得分:0)

另一个对我有用的解决方案是通过设置env:

来使用更高版本的rails
export RAILS_GEM_VERSION=2.3.12