未初始化的常量 ActiveSupport::Dependencies::Mutex(NameError)

12 浏览
0 Comments

未初始化的常量 ActiveSupport::Dependencies::Mutex(NameError)

当我想创建一个Ruby on Rails项目时,我会收到下面的信息。

/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:55: uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support.rb:57
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /usr/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/rails_generator.rb:31
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /usr/lib/ruby/gems/1.8/gems/rails-2.3.8/bin/rails:15
    from /usr/bin/rails:19:in `load'
    from /usr/bin/rails:19

出了什么问题?我该怎么解决它?

admin 更改状态以发布 2023年5月24日
0
0 Comments

我通过将RubyGems降级到1.5.3版本来解决这个问题,因为在RubyGems 1.6.0+和Rails < 2.3.11中会出现这个问题:

gem update --system 1.5.3

如果您之前降级到更早的版本并想要更新到1.5.3版本,则在尝试运行时可能会获得以下内容:

Updating RubyGems
ERROR:  While executing gem ... (RuntimeError)
    No gem names are allowed with the --system option

如果出现该错误,则更新,以便让您指定版本,然后再次降级:

gem update --system
gem update --system 1.5.3

0
0 Comments

如果您无法升级到Ruby on Rails 2.3.11(并扩展douglasr的回答),线程必须在boot.rb的顶部进行要求。例如:

require 'thread'
# Don't change this file!
# Configure your app in config/environment.rb and config/environments/*.rb
...

0