没有这样的文件加载 - factory_girl

时间:2011-07-27 15:44:32

标签: ruby-on-rails ruby redmine

我正在尝试将Redmine升级到1.2.1。执行bundle exec rake db:migrate RAILS_ENV=production时出现此错误:

no such file to load -- factory_girl
/usr/local/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:184:in `require'
/usr/local/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:184:in `require'
/usr/local/redmine-1.2.1/vendor/plugins/redmine_import_from_csv/test/factories.rb:1
/usr/local/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:184:in `require'
/usr/local/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:184:in `require'
/usr/local/redmine-1.2.1/vendor/plugins/redmine_import_from_csv/init.rb:4:in `evaluate_init_rb'
/usr/local/redmine-1.2.1/config/../vendor/rails/railties/lib/rails/plugin.rb:158:in `evaluate_init_rb'
/usr/local/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
/usr/local/redmine-1.2.1/config/../vendor/rails/railties/lib/rails/plugin.rb:154:in `evaluate_init_rb'
/usr/local/redmine-1.2.1/config/../vendor/rails/railties/lib/rails/plugin.rb:48:in `load'
/usr/local/redmine-1.2.1/config/../vendor/plugins/engines/lib/engines/plugin.rb:44:in `load'
/usr/local/redmine-1.2.1/config/../vendor/rails/railties/lib/rails/plugin/loader.rb:38:in `load_plugins'
/usr/local/redmine-1.2.1/config/../vendor/rails/railties/lib/rails/plugin/loader.rb:37:in `each'
/usr/local/redmine-1.2.1/config/../vendor/rails/railties/lib/rails/plugin/loader.rb:37:in `load_plugins'
/usr/local/redmine-1.2.1/config/../vendor/rails/railties/lib/initializer.rb:369:in `load_plugins'
/usr/local/redmine-1.2.1/config/../vendor/rails/railties/lib/initializer.rb:165:in `process'
/usr/local/redmine-1.2.1/config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
/usr/local/redmine-1.2.1/config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
/usr/local/redmine-1.2.1/config/environment.rb:20
/usr/local/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:182:in `require'
/usr/local/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:182:in `require'
/usr/local/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:547:in `new_constants_in'
/usr/local/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:182:in `require'
/usr/local/redmine-1.2.1/vendor/rails/railties/lib/tasks/misc.rake:4
/usr/local/redmine-1.2.1/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/usr/local/redmine-1.2.1/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:205:in `execute'
/usr/local/redmine-1.2.1/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/usr/local/redmine-1.2.1/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/usr/local/redmine-1.2.1/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/usr/local/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/local/redmine-1.2.1/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/redmine-1.2.1/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:176:in `invoke_prerequisites'
/usr/local/redmine-1.2.1/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:174:in `each'
/usr/local/redmine-1.2.1/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/usr/local/redmine-1.2.1/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:157:in `invoke_with_call_chain'
/usr/local/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/local/redmine-1.2.1/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/redmine-1.2.1/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/usr/local/redmine-1.2.1/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/usr/local/redmine-1.2.1/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level'
/usr/local/redmine-1.2.1/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/usr/local/redmine-1.2.1/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level'
/usr/local/redmine-1.2.1/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/usr/local/redmine-1.2.1/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/usr/local/redmine-1.2.1/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:62:in `run'
/usr/local/redmine-1.2.1/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/usr/local/redmine-1.2.1/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/usr/local/redmine-1.2.1/vendor/bundle/ruby/1.8/gems/rake-0.9.2/bin/rake:32
/usr/local/redmine-1.2.1/vendor/bundle/ruby/1.8/bin/rake:19:in `load'
/usr/local/redmine-1.2.1/vendor/bundle/ruby/1.8/bin/rake:19
Tasks: TOP => db:migrate => environment

我尝试在Gemfile中添加factory_girl并执行bundle install --path vendor/bundle

我收到了另一个错误:

Could not find gem 'factory_girl (~> 2.0.1, runtime)' in any of the gem sources listed in your Gemfile.

以下是Gemfile

source "http://rubygems.org"
gem "rails", "2.3.11"
gem "rack", "1.1.1"
gem "i18n", "0.4.2"
gem "rubytree"
gem "coderay",  "~> 0.9.7"
gem "mysql"
gem "factory_girl"

我该怎么办?

1 个答案:

答案 0 :(得分:3)

我认为你需要使用factory_girl版本1.2.4,所以在你的Gemfile中更改它:

gem 'factory_girl', '1.2.4'

这是在版本1.3.3的自述文件中:

“如果你想在Rails 3之前使用Rails版本的factory_girl,请使用版本1.2.4。”