4

当我在 env.rb 中需要“active_record”时,我遇到了错误

constant Logger::Format not defined (NameError)

/usr/local/rvm/gems/ruby-1.9.3-p125@test/gems/activerecord-1.6.0/lib/active_record/support/clean_logger.rb:5:in remove_const' /usr/local/rvm/gems/ruby-1.9.3-p125@test/gems/activerecord-1.6.0/lib/active_record/support/clean_logger.rb:5:in'/usr/local/rvm/gems/ ruby-1.9.3-p125@test/gems/activerecord-1.6.0/lib/active_record/support/clean_logger.rb:3:in <top (required)>' /usr/local/rvm/gems/ruby-1.9.3-p125@test/gems/activerecord-1.6.0/lib/active_record.rb:28:inrequire' /usr/local/rvm/gems/ruby-1.9.3-p125@ test/gems/activerecord-1.6.0/lib/active_record.rb:28:in<top (required)>' /home/vijay_demo_project/bank_cucumber/features/support/env.rb:62:in要求'/home/vijay_demo_project/bank_cucumber/features/support/env.rb:62:in <top (required)>' /usr/local/rvm/gems/ruby-1.9.3-p125@test/gems/cucumber-1.2.2/lib/cucumber/rb_support/rb_language.rb:137:inload'/usr/local/rvm/gems/ ruby-1.9.3-p125@test/gems/cucumber-1.2.2/lib/cucumber/rb_support/rb_language.rb:137:in load_file load_code_file' /usr/local/rvm/gems/ruby-1.9.3-p125@test/gems/cucumber-1.2.2/lib/cucumber/runtime/support_code.rb:180:in' /usr/local/rvm/gems/ruby-1.9.3-p125@ test/gems/cucumber-1.2.2/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'

My GemFile is: 

source 'http://rubygems.org'

gem 'rspec'
gem 'cucumber'
gem 'capybara'
gem 'headless'
gem 'debugger'
gem 'faker'
gem 'selenium-webdriver', '2.30.0'
gem 'mail'
gem 'database_cleaner'
gem 'rake'
gem "factory_girl"
gem 'activerecord'
gem 'faker'
gem 'logger'

Gemfile.lock 是

GEM
remote: http://rubygems.org/
specs:
activerecord (1.6.0)
activesupport (3.2.12)
  i18n (~> 0.6)
  multi_json (~> 1.0)
builder (3.2.0)
capybara (2.0.2)
  mime-types (>= 1.16)
  nokogiri (>= 1.3.3)
  rack (>= 1.0.0)
  rack-test (>= 0.5.4)
  selenium-webdriver (~> 2.0)
  xpath (~> 1.0.0)
childprocess (0.3.9)
  ffi (~> 1.0, >= 1.0.11)
columnize (0.3.6)
cucumber (1.2.2)
  builder (>= 2.1.2)
  diff-lcs (>= 1.1.3)
  gherkin (~> 2.11.6)
  multi_json (~> 1.3)
database_cleaner (1.0.1)
debugger (1.4.0)
  columnize (>= 0.3.1)
  debugger-linecache (~> 1.1.1)
  debugger-ruby_core_source (~> 1.2.0)
debugger-linecache (1.1.2)
  debugger-ruby_core_source (>= 1.1.1)
debugger-ruby_core_source (1.2.0)
diff-lcs (1.2.1)
factory_girl (4.2.0)
  activesupport (>= 3.0.0)
faker (1.1.2)
  i18n (~> 0.5)
ffi (1.4.0)
gherkin (2.11.6)
  json (>= 1.7.6)
headless (1.0.1)
i18n (0.6.4)
json (1.7.7)
logger (1.2.8)
mail (2.5.3)
  i18n (>= 0.4.0)
  mime-types (~> 1.16)
  treetop (~> 1.4.8)
mime-types (1.21)
multi_json (1.6.1)
nokogiri (1.5.6)
polyglot (0.3.3)
rack (1.5.2)
rack-test (0.6.2)
  rack (>= 1.0)
rake (10.0.3)
rspec (2.13.0)
  rspec-core (~> 2.13.0)
  rspec-expectations (~> 2.13.0)
  rspec-mocks (~> 2.13.0)
rspec-core (2.13.0)
rspec-expectations (2.13.0)
  diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.13.0)
rubyzip (0.9.9)
selenium-webdriver (2.30.0)
  childprocess (>= 0.2.5)
  multi_json (~> 1.0)
  rubyzip
  websocket (~> 1.0.4)
treetop (1.4.12)
  polyglot
  polyglot (>= 0.3.1)
websocket (1.0.7)
xpath (1.0.0)
  nokogiri (~> 1.3)

PLATFORMS
  ruby

DEPENDENCIES
  activerecord
  capybara
  cucumber
  database_cleaner
  debugger
  factory_girl
  faker
  headless
  logger
  mail
  rake
  rspec
  selenium-webdriver (= 2.30.0)

请帮助我如何解决它。我正在使用 ruby​​1.9.3

4

2 回答 2

4

这里有问题,activerecord (1.6.0)所以你必须用最新版本 3.2.13' 升级它

gem 'activerecord', '~>3.2.13'由于存在一些依赖关系,因此定义了 activerecord gem 。

于 2013-05-21T08:36:29.063 回答
0

为了解决这个问题,你可以简单地运行“bundle update”命令

于 2014-02-10T21:02:26.307 回答