我正在尝试
rake db:migrate
但每次我都会遇到以下错误:
rake aborted!
can't activate test-unit (= 1.2.3), already activated test-unit-2.3.0. Make sure all dependencies are added to Gemfile.
/Users/petenixey/project/Rakefile:12:in `<top (required)>'
(See full trace by running task with --trace)
Peters-MacBook-Air:pingpanel petenixey$
我有其他宝石依赖于test-unti 2.3.0而且我似乎找不到其他人有同样的问题。
我最近在宝石问题上遇到了一些垃圾时间,非常感谢人们的建议。谢谢
修改 我注意到的另一件事是,如果我使用下面的gemfiles和gemsets创建一个全新的Rails项目,那么rake db:migrate 会工作。这会告诉我在环境设置或类似情况下出现问题,但我无法弄清楚是什么。
----------------使用--trace
运行时出现完整错误rake aborted!
can't activate test-unit (= 1.2.3), already activated test-unit-2.3.0. Make sure all dependencies are added to Gemfile.
/Users/petenixey/.rvm/gems/ruby-1.9.2-p180@global/gems/bundler-1.0.13/lib/bundler/rubygems_integration.rb:150:in `block in replace_gem'
/Users/petenixey/project/tasks/rspec.rake:1:in `<top (required)>'
/Users/petenixey/.rvm/gems/ruby-1.9.2-p180@test/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:235:in `load'
/Users/petenixey/.rvm/gems/ruby-1.9.2-p180@test/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:235:in `block in load'
/Users/petenixey/.rvm/gems/ruby-1.9.2-p180@test/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in `block in load_dependency'
/Users/petenixey/.rvm/gems/ruby-1.9.2-p180@test/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:596:in `new_constants_in'
/Users/petenixey/.rvm/gems/ruby-1.9.2-p180@test/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in `load_dependency'
/Users/petenixey/.rvm/gems/ruby-1.9.2-p180@test/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:235:in `load'
/Users/petenixey/.rvm/gems/ruby-1.9.2-p180@test/gems/railties-3.0.7/lib/rails/engine.rb:131:in `block in load_tasks'
/Users/petenixey/.rvm/gems/ruby-1.9.2-p180@test/gems/railties-3.0.7/lib/rails/engine.rb:131:in `each'
/Users/petenixey/.rvm/gems/ruby-1.9.2-p180@test/gems/railties-3.0.7/lib/rails/engine.rb:131:in `load_tasks'
/Users/petenixey/.rvm/gems/ruby-1.9.2-p180@test/gems/railties-3.0.7/lib/rails/application.rb:141:in `load_tasks'
/Users/petenixey/.rvm/gems/ruby-1.9.2-p180@test/gems/railties-3.0.7/lib/rails/application.rb:77:in `method_missing'
/Users/petenixey/Dropbox/rails/pingpanel/Rakefile:12:in `<top (required)>'
/Users/petenixey/.rvm/gems/ruby-1.9.2-p180@test/gems/rake-0.8.7/lib/rake.rb:2383:in `load'
/Users/petenixey/.rvm/gems/ruby-1.9.2-p180@test/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile'
/Users/petenixey/.rvm/gems/ruby-1.9.2-p180@test/gems/rake-0.8.7/lib/rake.rb:2017:in `block in load_rakefile'
/Users/petenixey/.rvm/gems/ruby-1.9.2-p180@test/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/petenixey/.rvm/gems/ruby-1.9.2-p180@test/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile'
/Users/petenixey/.rvm/gems/ruby-1.9.2-p180@test/gems/rake-0.8.7/lib/rake.rb:2000:in `block in run'
/Users/petenixey/.rvm/gems/ruby-1.9.2-p180@test/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/petenixey/.rvm/gems/ruby-1.9.2-p180@test/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Users/petenixey/.rvm/gems/ruby-1.9.2-p180@test/gems/rake-0.8.7/bin/rake:31:in `<top (required)>'
/Users/petenixey/.rvm/gems/ruby-1.9.2-p180@test/bin/rake:19:in `load'
/Users/petenixey/.rvm/gems/ruby-1.9.2-p180@test/bin/rake:19:in `<main>'
-------------- Gemfile
source :rubygems
gem "authlogic"
gem "sqlite3-ruby", :require => "sqlite3"
gem 'jquery-rails', '>= 0.2.6'
gem "hoptoad_notifier"
gem "rake"
gem "rails", ">=3.0.7"
gem "heroku"
group :development, :test do
# up to date
gem "faker"
gem "factory_girl_rails"
gem "ruby-debug19"
gem "capybara", ">= 0.4.1.2"
gem 'cucumber-rails'
gem 'database_cleaner'
gem "rspec-rails"
gem 'test-unit'
end
gem "launchy"
gem "autotest"
gem "autotest-growl"
gem "autotest-rails-pure"
gem "autotest-fsevent"
gem 'metric_fu'
----------------- Gemfile lock
GEM
remote: http://rubygems.org/
specs:
Saikuro (1.1.0)
ZenTest (4.5.0)
abstract (1.0.0)
actionmailer (3.0.7)
actionpack (= 3.0.7)
mail (~> 2.2.15)
actionpack (3.0.7)
activemodel (= 3.0.7)
activesupport (= 3.0.7)
builder (~> 2.1.2)
erubis (~> 2.6.6)
i18n (~> 0.5.0)
rack (~> 1.2.1)
rack-mount (~> 0.6.14)
rack-test (~> 0.5.7)
tzinfo (~> 0.3.23)
activemodel (3.0.7)
activesupport (= 3.0.7)
builder (~> 2.1.2)
i18n (~> 0.5.0)
activerecord (3.0.7)
activemodel (= 3.0.7)
activesupport (= 3.0.7)
arel (~> 2.0.2)
tzinfo (~> 0.3.23)
activeresource (3.0.7)
activemodel (= 3.0.7)
activesupport (= 3.0.7)
activesupport (3.0.7)
archive-tar-minitar (0.5.2)
arel (2.0.10)
arrayfields (4.7.4)
authlogic (3.0.3)
activerecord (>= 3.0.7)
activerecord (>= 3.0.7)
autotest (4.4.6)
ZenTest (>= 4.4.1)
autotest-fsevent (0.2.5)
sys-uname
autotest-growl (0.2.9)
autotest-rails-pure (4.1.2)
builder (2.1.2)
capybara (0.4.1.2)
celerity (>= 0.7.9)
culerity (>= 0.2.4)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (>= 0.0.27)
xpath (~> 0.1.3)
celerity (0.8.9)
childprocess (0.1.9)
ffi (~> 1.0.6)
chronic (0.3.0)
churn (0.0.13)
chronic (>= 0.2.3)
hirb
json_pure
main
ruby_parser (~> 2.0.4)
sexp_processor (~> 3.0.3)
colored (1.2)
columnize (0.3.2)
configuration (1.2.0)
cucumber (0.10.2)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
gherkin (>= 2.3.5)
json (>= 1.4.6)
term-ansicolor (>= 1.0.5)
cucumber-rails (0.4.1)
cucumber (>= 0.10.1)
nokogiri (>= 1.4.4)
rack-test (>= 0.5.7)
culerity (0.2.15)
database_cleaner (0.6.7)
diff-lcs (1.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
factory_girl (1.3.3)
factory_girl_rails (1.0.1)
factory_girl (~> 1.3)
railties (>= 3.0.0)
faker (0.9.5)
i18n (~> 0.4)
fattr (2.2.0)
ffi (1.0.8)
flay (1.4.2)
ruby_parser (~> 2.0)
sexp_processor (~> 3.0)
flog (2.5.1)
ruby_parser (~> 2.0)
sexp_processor (~> 3.0)
gherkin (2.3.8)
json (>= 1.4.6)
haml (3.1.1)
heroku (2.1.4)
launchy (>= 0.3.2)
rest-client (~> 1.6.1)
term-ansicolor (~> 1.0.5)
hirb (0.4.5)
hoptoad_notifier (2.4.9)
activesupport
builder
i18n (0.5.0)
jquery-rails (1.0.5)
railties (~> 3.0)
thor (~> 0.14)
json (1.5.1)
json_pure (1.5.1)
launchy (0.4.0)
configuration (>= 0.0.5)
rake (>= 0.8.1)
linecache19 (0.5.12)
ruby_core_source (>= 0.1.4)
mail (2.2.19)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
main (4.4.0)
arrayfields (>= 4.7.4)
fattr (>= 2.1.0)
metric_fu (2.1.1)
Saikuro (>= 1.1.0)
activesupport (>= 2.0.0)
chronic (~> 0.3.0)
churn (>= 0.0.7)
flay (>= 1.2.1)
flog (>= 2.3.0)
rails_best_practices (>= 0.6.4)
rcov (>= 0.8.3.3)
reek (>= 1.2.6)
roodi (>= 2.1.0)
syntax
mime-types (1.16)
nokogiri (1.4.4)
polyglot (0.3.1)
rack (1.2.2)
rack-mount (0.6.14)
rack (>= 1.0.0)
rack-test (0.5.7)
rack (>= 1.0)
rails (3.0.7)
actionmailer (= 3.0.7)
actionpack (= 3.0.7)
activerecord (= 3.0.7)
activeresource (= 3.0.7)
activesupport (= 3.0.7)
bundler (~> 1.0)
railties (= 3.0.7)
rails_best_practices (0.9.0)
activesupport
colored
erubis
haml
i18n
ruby-progressbar
ruby_parser
railties (3.0.7)
actionpack (= 3.0.7)
activesupport (= 3.0.7)
rake (>= 0.8.7)
thor (~> 0.14.4)
rake (0.8.7)
rcov (0.9.9)
reek (1.2.8)
ruby2ruby (~> 1.2)
ruby_parser (~> 2.0)
sexp_processor (~> 3.0)
rest-client (1.6.1)
mime-types (>= 1.16)
roodi (2.1.0)
ruby_parser
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
rspec-mocks (~> 2.6.0)
rspec-core (2.6.1)
rspec-expectations (2.6.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.6.0)
rspec-rails (2.6.0)
actionpack (~> 3.0)
activesupport (~> 3.0)
railties (~> 3.0)
rspec (~> 2.6.0)
ruby-debug-base19 (0.11.25)
columnize (>= 0.3.1)
linecache19 (>= 0.5.11)
ruby_core_source (>= 0.1.4)
ruby-debug19 (0.11.6)
columnize (>= 0.3.1)
linecache19 (>= 0.5.11)
ruby-debug-base19 (>= 0.11.19)
ruby-progressbar (0.0.10)
ruby2ruby (1.2.5)
ruby_parser (~> 2.0)
sexp_processor (~> 3.0)
ruby_core_source (0.1.5)
archive-tar-minitar (>= 0.5.2)
ruby_parser (2.0.6)
sexp_processor (~> 3.0)
rubyzip (0.9.4)
selenium-webdriver (0.2.0)
childprocess (>= 0.1.7)
ffi (>= 1.0.7)
json_pure
rubyzip
sexp_processor (3.0.5)
sqlite3 (1.3.3)
sqlite3-ruby (1.3.3)
sqlite3 (>= 1.3.3)
syntax (1.0.0)
sys-uname (0.8.5)
term-ansicolor (1.0.5)
test-unit (2.3.0)
thor (0.14.6)
treetop (1.4.9)
polyglot (>= 0.3.1)
tzinfo (0.3.27)
xpath (0.1.4)
nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
authlogic
autotest
autotest-fsevent
autotest-growl
autotest-rails-pure
capybara (>= 0.4.1.2)
cucumber-rails
database_cleaner
factory_girl_rails
faker
heroku
hoptoad_notifier
jquery-rails (>= 0.2.6)
launchy
metric_fu
rails (>= 3.0.7)
rspec-rails
ruby-debug19
sqlite3-ruby
test-unit
答案 0 :(得分:8)
最后解决了这个问题。感谢上帝能够从头开始创建rails项目并逐个添加内容。
通过在我的新项目和旧项目之间逐步添加每组设置和初始化程序,我最终将问题缩小到rspec.rake文件:
/lib/tasks/rspec.rake
我正在使用rspec-rails(即在Rails 3上运行的Rspec 2)。问题是这个rspec.rake文件在rspec-rails中实际上并不是必需的,显然也会搞砸了。
为了验证这一点,我运行了全新的rspec-rails(rails生成rspec:install),并注意到rake文件不再创建(我认为它已经被宝石吸收了)。
总而言之,删除rspec.rake使一切工作再次起作用 - rake db:migrate和rspec spec。