不知道如何在Ubuntu natty上构建rake db:migrate?

我不知道如何使用Capistrano部署应用程序,但我想我至少尝试在部署服务器上加载我需要的所有文件,所以我在Github上做了一个git pull并使用bundle install安装了所有依赖项。 我使用Rails 3.0.9在Ruby 1.9.2p180中运行RVM 1.6.32,当我运行rake db:migrate时,我得到了

rake aborted! Don't know how to build task 'db:migrate'

我没有其他SO用户提到的双重分号问题,所以我真的很困惑。 我安装了0.9.2和0.8.7,以及捆绑器1.0.17。 我的rvm实例显示rake (0.8.7 ruby)

出了什么问题?

– 编辑 –

rake –tasks的输出

 rake sunspot:reindex[batch_size,models] # Reindex all solr models that are... rake sunspot:solr:run # Run the Solr instance in the for... rake sunspot:solr:start # Start the Solr instance rake sunspot:solr:stop # Stop the Solr instance 

gem列表的输出是

 gem list *** LOCAL GEMS *** aaronh-chronic (0.3.9) abstract (1.0.0) actionmailer (3.0.9) actionpack (3.0.9) activemodel (3.0.9) activerecord (3.0.9) activeresource (3.0.9) activesupport (3.0.9) arel (2.0.10) authlogic (3.0.3) builder (2.1.2) bundler (1.0.17) capistrano (2.8.0) classifier (1.3.3) daemons (1.1.4) delayed_job (2.1.4) docsplit (0.5.2) erubis (2.6.6) escape (0.0.4) fast-stemmer (1.0.0) gsl (1.14.7) haml (3.1.2) highline (1.6.2) i18n (0.5.0) lda-ruby (0.3.7) madeleine (0.7.3) mail (2.2.19) mime-types (1.16) minitest (1.6.0) mysql (2.8.1) narray (0.5.9.9) net-ldap (0.2.2) net-scp (1.0.4) net-sftp (2.0.5) net-ssh (2.1.4) net-ssh-gateway (1.1.0) nokogiri (1.5.0) polyglot (0.3.1) pr_geohash (1.0.0) rack (1.2.3) rack-mount (0.6.14) rack-test (0.5.7) rails (3.0.9) rails3-generators (0.17.4) railties (3.0.9) rake (0.9.2, 0.8.7) rdoc (3.6.1, 2.5.8) rsolr (0.12.1) shoulda (2.11.3) thor (0.14.6) treetop (1.4.9) tzinfo (0.3.28) whenever (0.6.8) will_paginate (3.0.pre4) 

application.rb的输出是

 require File.expand_path('../boot', __FILE__) require 'rails/all' require 'net/http' require 'net/ldap' 

检查config/application.rb文件中是否require 'rails/all' 。 看起来sunspot改变了你的配置。

您也可以尝试更新您的bundler第一个gem update bundler

尝试运行bundle exec rake db:migrate 。 问题可能是你没有从bundle中加载gem,因此没有得到那些gem中定义的任务(比如Rails!)。

检查Rails.application.load_tasks中是否有Rails.application.load_tasks。

如果不是,请添加该行。