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

时间:2011-08-09 21:06:07

标签: ruby-on-rails ruby-on-rails-3 rake bundler

我不知道如何使用Capistrano部署应用程序,但我想我至少尝试在部署服务器上加载我需要的所有文件,所以我在Github上做了一个git pull并使用所有依赖项安装捆绑安装。我使用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 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'

4 个答案:

答案 0 :(得分:9)

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

您也可以尝试先更新您的捆绑包gem update bundler

答案 1 :(得分:6)

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

答案 2 :(得分:0)

检查您的Rakefile中是否有Rails.application.load_tasks

如果不是,请添加该行。

答案 3 :(得分:0)

我用这个命令解决了

bundle install --deployment