我使用BrowserCMS构建了一个旧版本的Rails项目 在配置/环境文件
中RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION
所以我使用rvm安装了这个宝石,所以我可以运行它
$ gem list
*** LOCAL GEMS ***
actionmailer (2.3.8, 2.3.4)
actionpack (2.3.8, 2.3.4)
activerecord (2.3.8, 2.3.4)
activeresource (2.3.8, 2.3.4)
activesupport (2.3.8, 2.3.4)
bundler (1.1.4)
mysql (2.8.1)
rack (1.1.3, 1.0.1)
rails (2.3.4)
rake (0.8.7)
我运行rake db:create
它工作正常,但当我运行rake db:migrate
时出现此错误
rake aborted!
undefined method `name' for "actionmailer":String
我尝试使用Trace,但我没有得到任何可以帮助
$ rake db:migrate --trace
(in /home/azzurrio/Desktop/berkmancenter-fair_use_tool-f8f65ea)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
undefined method `name' for "actionmailer":String
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rails-2.3.4/lib/rails/gem_dependency.rb:268:in `=='
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:217:in `==='
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:217:in `matching_specs'
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `find_all'
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/specification.rb:411:in `each'
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/specification.rb:410:in `each'
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:216:in `find_all'
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:216:in `matching_specs'
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:238:in `to_specs'
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:256:in `to_spec'
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems.rb:1210:in `gem'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rails-2.3.4/lib/rails/gem_dependency.rb:73:in `add_load_paths'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rails-2.3.4/lib/initializer.rb:301:in `add_gem_load_paths'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rails-2.3.4/lib/initializer.rb:301:in `each'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rails-2.3.4/lib/initializer.rb:301:in `add_gem_load_paths'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rails-2.3.4/lib/initializer.rb:132:in `process'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rails-2.3.4/lib/initializer.rb:113:in `send'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rails-2.3.4/lib/initializer.rb:113:in `run'
/home/azzurrio/Desktop/berkmancenter-fair_use_tool-f8f65ea/config/environment.rb:9
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in `new_constants_in'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rails-2.3.4/lib/tasks/misc.rake:4
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/usr/share/ruby-rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/gems/rake-0.8.7/bin/rake:31
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/bin/rake:19:in `load'
/usr/share/ruby-rvm/gems/ruby-1.8.7-p358/bin/rake:19
有什么帮助吗?
答案 0 :(得分:33)
我有这个问题。 解决方案是将rubygems降级到您支持的版本。
我需要版本1.3.5(对于rails 2.3.5)
所以你需要这样做:
gem install rubygems-update -v 1.3.5
update_rubygems --version = 1.3.5
现在rake应该可以工作。
答案 1 :(得分:-1)
我认为你应该更新RubyGems版本
试试gem install rubygems-update
。