Ruby 1.8.x Rails 2.x 的 "uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)" 错误...

坑爹的异常。

Ruby 1.8.x Rails 2.x 的 "uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)" 错误...

在 Ruby 安装目录下的 bin 目录下找到 rails 文件:比如:C:\Ruby187\bin
修改 rails,在 require 'rubygems' 之后加上 require 'thread'
#!C:/Ruby187/bin/ruby.exe # # This file was generated by RubyGems. # # The application 'rails' is installed as part of a gem, and # this file is here to facilitate running it. # require 'thread' require 'rubygems' version = ">= 0" if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then version = $1 ARGV.shift end gem 'rails', version load Gem.bin_path('rails', 'rails', version)
接下来运行 rails SomeApp 生成 Rails 应用之后,再启动rake:ruby Script/Sever 还会出上面的错误,则需要在
Ruby 安装目录下,查找 environment.rb,boot.rb 文件,同样在前面加上require 'thread'