简体   繁体   中英

“undefined method name for” “RubyInline:String” in Rails 2.3.8 app

I'm having an interesting problem getting an existing Rails 2.3.8 app running on a new Linux install. I have installed the same version of all gems as the server this runs on.

For a start, I've had to modify Rakefile to include the following line, to stop an error about uninitialized constant ActiveSupport::Dependencies::Mutex -

require 'thread'

I consider this unusual, because the version of the gems on the server match what I have installed on my local machine. Surely the same code should function just the same. I feel I must be missing something obvious.

Anyway, with the patch in place for this I get another error: "undefined method name for" "RubyInline:String"

I've found solutions to fix this of simply upgrading to rails 2.3.12 - I'm not keen on this idea since I want to be running the same version of rails for testing purposes as is on the production server. I did try it out of desperation but it just pushed the error somewhere else.

config/environment.rb:12 (and a few proceeding lines)

Rails::Initializer.run do |config|
  config.gem 'hobo'
  config.gem 'prawn'
  config.gem 'image_science'
  config.gem 'geokit'
  config.gem 'redis'

Output from 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

The solution to this problem was to downgrade rubygems (the gem command) from the installed version to 1.3.5 - the same version as is installed in production.

There may be a better way to do this, but I used the following commands:

gem install -v 1.3.5 rubygems-update
ruby `gem env gemdir`/gems/rubygems-update-1.3.5/setup.rb

I hope this helps anyone who has found themselves in this frustrating situation and ends up here via Google.

I found the commands to install a specific version of rubygems here: updating rubygems to specific version on mac

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM