Don't know how to build rake db:migrate on Ubu

2019-07-04 03:07发布

I'm not sure how to deploy an application using Capistrano but I figured I'd try to at least load all the files I need on my deployment server, so I did a git pull on Github and installed all the dependencies using bundle install. I have RVM 1.6.32 running in Ruby 1.9.2p180 with Rails 3.0.9 and when I run rake db:migrate, I get

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

I don't have the double semi-colon issue that other SO users have mentioned, so I'm genuinely confused. I have rake both 0.9.2 and 0.8.7 installed, as well as bundler 1.0.17. My rvm instance shows rake (0.8.7 ruby)

What's going wrong?

-- Edit --

The output of 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

The output of gem list is

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)

The output of application.rb is

require File.expand_path('../boot', __FILE__)

require 'rails/all'
require 'net/http'
require 'net/ldap'

4条回答
地球回转人心会变
2楼-- · 2019-07-04 04:02

Try running bundle exec rake db:migrate instead. The problem may be that you're not loading in the gems from bundler, and so not getting the tasks defined in those gems (like Rails!).

查看更多
Juvenile、少年°
3楼-- · 2019-07-04 04:03

check if require 'rails/all' presents in your config/application.rb file. Looks like sunspot have changed your configs.

also you can try to update your bundler first gem update bundler

查看更多
干净又极端
4楼-- · 2019-07-04 04:05

Check if you have Rails.application.load_tasks in your Rakefile.

If no, add that line.

查看更多
霸刀☆藐视天下
5楼-- · 2019-07-04 04:09

I solved with this command

bundle install --deployment
查看更多
登录 后发表回答