我尝试从OSX到Debian运行一个工作轨道项目。我在两个系统RVM上使用并为项目创建了相同的gemsets和rvmrc。在Debian上我只用rvm安装了ruby,没有系统安装ruby存在。
当我跳进项目文件夹时,rvm正在切换到版本1.8.7并使用项目gemset,一切看起来都很好。
但是当我启动耙子时,我得到了这个错误:
$ rake -T --trace
(in /home/i/project/src)
rake aborted!
uninitialized constant ActiveSupport::Dependencies::Mutex
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rake-0.8.7/lib/rake.rb:2503:in `const_missing'
/home/i/.rvm/gems/ruby-1.8.7-p249@project/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/ruby-1.8.7-p249@project/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/ruby-1.8.7-p249@project/gems/rails-2.3.5/lib/tasks/misc.rake:18
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rails-2.3.5/lib/tasks/rails.rb:4:in `load'
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rails-2.3.5/lib/tasks/rails.rb:4
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rails-2.3.5/lib/tasks/rails.rb:4:in `each'
/home/i/.rvm/gems/ruby-1.8.7-p249@project/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/ruby-1.8.7-p249@project/gems/rake-0.8.7/lib/rake.rb:2383:in `load'
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile'
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rake-0.8.7/lib/rake.rb:2017:in `load_rakefile'
/ home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile'
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rake-0.8.7/lib/rake.rb:2000:in `run'
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/home/i/.rvm/gems/ruby-1.8.7-p249@project/gems/rake-0.8.7/bin/rake:31
/home/i/.rvm/gems/ruby-1.8.7-p249@project/bin/rake:19:in `load'
/home/i/.rvm/gems/ruby-1.8.7-p249@project/bin/rake:19
答案 0 :(得分:19)
对我来说,添加require'thread
'也不起作用。
通过将rubygems
降级为1.4.2来解决问题:
较新版本的rubygems
(在我的情况下,1.8.5)和旧版本的rails(在我的情况下为2.3.5)之间存在兼容性问题
$ gem install rubygems-update -v='1.4.2'
$ gem uninstall rubygems-update -v='1.8.5'
$ update_rubygems
答案 1 :(得分:13)
我的解决方案。添加以下行:
require 'thread'
在rails项目根目录下的Rakefile的第一行。神奇地所有人都会跑; - )
答案 2 :(得分:7)
我不久前就碰到了这个。如果你谷歌搜索它,你会发现一些博客和邮件列表帖子,建议你在require "threads"
中明确地environment.rb
。然而,这对我来说不起作用,但降级rubygems确实:
sudo gem update --system 1.3.7
有些帖子还提到升级到更新版本的Rails,目前在我们的案例中不是一个选项。
答案 3 :(得分:0)
你可以通过升级rails来解决它
gem install rails --version 2.3.11
或降级宝石
sudo gem update --system 1.5.3