2011-04-06 71 views
6

我嘗試從OSX運行一個正在運行的rails項目到Debian。我在兩個系統上使用RVM,併爲該項目創建了相同的gemsets和rvmrc。在Debian上我只安裝了ruby和rvm,沒有系統安裝ruby存在。未初始化的常量ActiveSupport :: Dependencies :: Mutex

當我在項目文件夾中跳轉rvm正在切換到1.8.7版本並且正在使用項目gemset時,一切看起來都很好。

但是當我火了一耙-T我得到這個錯誤:

$ rake -T --trace 
(in /home/i/project/src) 
rake aborted! 
uninitialized constant ActiveSupport::Dependencies::Mutex 
/home/i/.rvm/gems/[email protected]/gems/rake-0.8.7/lib/rake.rb:2503:in `const_missing' 
/home/i/.rvm/gems/[email protected]/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/[email protected]/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/[email protected]/gems/rails-2.3.5/lib/tasks/misc.rake:18 
/home/i/.rvm/gems/[email protected]/gems/rails-2.3.5/lib/tasks/rails.rb:4:in `load' 
/home/i/.rvm/gems/[email protected]/gems/rails-2.3.5/lib/tasks/rails.rb:4 
/home/i/.rvm/gems/[email protected]/gems/rails-2.3.5/lib/tasks/rails.rb:4:in `each' 
/home/i/.rvm/gems/[email protected]/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/[email protected]/gems/rake-0.8.7/lib/rake.rb:2383:in `load' 
/home/i/.rvm/gems/[email protected]/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile' 
/home/i/.rvm/gems/[email protected]/gems/rake-0.8.7/lib/rake.rb:2017:in `load_rakefile' 
/ home/i/.rvm/gems/[email protected]/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' 
/home/i/.rvm/gems/[email protected]/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile' 
/home/i/.rvm/gems/[email protected]/gems/rake-0.8.7/lib/rake.rb:2000:in `run' 
/home/i/.rvm/gems/[email protected]/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' 
/home/i/.rvm/gems/[email protected]/gems/rake-0.8.7/lib/rake.rb:1998:in `run' 
/home/i/.rvm/gems/[email protected]/gems/rake-0.8.7/bin/rake:31 
/home/i/.rvm/gems/[email protected]/bin/rake:19:in `load' 
/home/i/.rvm/gems/[email protected]/bin/rake:19 
+3

可能的重複[未初始化常量ActiveSupport :: Dependencies :: Mutex(NameError)](http://stackoverflow.com/questions/5176782/uninitialized-constant-activesupportdependenciesmutex-nameerror) – 2011-11-09 13:11:23

回答

13

我的工作解決方案。添加以下行:

require 'thread' 

Railsfile在您的rails項目根目錄的第一行。神奇地所有將運行;-)

7

我碰到了這個自己不是很久以前。如果你谷歌它,你會發現一些博客和郵件列表帖子,建議你在你的environment.rb明確require "threads"。然而,這並沒有爲我工作,但降級的RubyGems做:

sudo gem update --system 1.3.7 

一些帖子還提到升級到Rails的一個新版本,這是不是在我們目前的情況選擇。

19

對我來說,添加要求'thread'也沒有工作。

它的rubygems新版本之間和軌舊版本(在我的情況2.3.5)

的兼容性問題(在我的情況,1.8.5): 問題被降級 rubygems到1.4.2解決
$ gem install rubygems-update -v='1.4.2' 

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

$ update_rubygems 
0

可以通過升級軌

gem install rails --version 2.3.11 

解決它或降級寶石

sudo gem update --system 1.5.3 
相關問題