我遇到一个有趣的问题,即在新的Linux安装上运行现有的Rails 2.3.8应用程序。我已经安装了与运行它的服务器相同版本的所有gem。
首先,我必须修改Rakefile以包含以下行,以停止有关未初始化的常量ActiveSupport :: Dependencies :: Mutex的错误 -
require 'thread'
我认为这很不寻常,因为服务器上的宝石版本与我在本地机器上安装的版本相匹配。当然相同的代码应该起到相同的作用。我觉得我必须遗漏一些明显的东西。
无论如何,有了这个补丁,我得到另一个错误:“RubyInline:String”的未定义方法名称
我找到了解决这个问题的解决方案,只需升级到rails 2.3.12 - 我并不热衷于这个想法,因为我想在生产服务器上运行相同版本的rails用于测试目的。我确实是出于绝望而尝试,但它只是将错误推到了其他地方。
config / environment.rb:12(和一些前进的行)
Rails::Initializer.run do |config|
config.gem 'hobo'
config.gem 'prawn'
config.gem 'image_science'
config.gem 'geokit'
config.gem 'redis'
rake db:reset --trace
的输出john@john-tosh:~/Work/source/AndroidServer2$ rake db:reset --trace
(in /home/graham/Work/source/AndroidServer2)
DEPRECATION WARNING: Rake tasks in vendor/plugins/open_flash_chart/tasks, vendor/plugins/prawnto/tasks, vendor/plugins/recaptcha/tasks, and vendor/plugins/ym4r_gm/tasks are deprecated. Use lib/tasks instead. (called from /var/lib/gems/1.8/gems/rails-2.3.8/lib/tasks/rails.rb:10)
** Invoke db:reset (first_time)
** Invoke db:drop (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:drop
** Invoke db:setup (first_time)
** Invoke db:create (first_time)
** Invoke db:load_config
** Execute db:create
** Invoke db:schema:load (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
undefined method `name' for "RubyInline":String
/var/lib/gems/1.8/gems/rails-2.3.8/lib/rails/gem_dependency.rb:275:in `=='
/usr/lib/ruby/vendor_ruby/1.8/rubygems/dependency.rb:217:in `==='
/usr/lib/ruby/vendor_ruby/1.8/rubygems/dependency.rb:217:in `matching_specs'
/usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `find_all'
/usr/lib/ruby/vendor_ruby/1.8/rubygems/specification.rb:410:in `each'
/usr/lib/ruby/vendor_ruby/1.8/rubygems/specification.rb:409:in `each'
/usr/lib/ruby/vendor_ruby/1.8/rubygems/dependency.rb:216:in `find_all'
/usr/lib/ruby/vendor_ruby/1.8/rubygems/dependency.rb:216:in `matching_specs'
/usr/lib/ruby/vendor_ruby/1.8/rubygems/dependency.rb:238:in `to_specs'
/usr/lib/ruby/vendor_ruby/1.8/rubygems/dependency.rb:256:in `to_spec'
/usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:1208:in `gem'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/rails/gem_dependency.rb:73:in `add_load_paths'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:301:in `add_gem_load_paths'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:301:in `each'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:301:in `add_gem_load_paths'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:132:in `process'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:in `send'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:in `run'
/home/graham/Work/source/AndroidServer2/config/environment.rb:12
/usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/var/lib/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
/var/lib/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'
/var/lib/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/tasks/misc.rake:4
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/var/lib/gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/local/bin/rake:19:in `load'
/usr/local/bin/rake:19
答案 0 :(得分:0)
此问题的解决方案是将rubygems(gem命令)从已安装的版本降级到1.3.5 - 与生产中安装的版本相同。
可能有更好的方法,但我使用了以下命令:
gem install -v 1.3.5 rubygems-update
ruby `gem env gemdir`/gems/rubygems-update-1.3.5/setup.rb
我希望这有助于任何发现自己处于这种令人沮丧的境地并通过谷歌来到这里的人。
我在这里找到了安装特定版本的rubygems的命令:updating rubygems to specific version on mac