【发布时间】:2018-07-13 03:49:43
【问题描述】:
我使用 Ruby on Rails 和 Spree 创建了一个应用程序。
将我的 SQlite 数据库更改为 PostgreSQL 后,我需要迁移我的数据库。 但是当我尝试运行 rake db:migrate, rake db:migrate RAILS_ENV=development, bin/rake db:migrate RAILS_ENV=development 时,我得到了同样的错误。
rake aborted!
Don't know how to build task 'db:migrate:up' (see --tasks)
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)
当我运行 --trace 时,我得到以下响应
** Invoke default (first_time)
** Invoke spec (first_time)
** Execute spec
/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -I/usr/local/rvm/gems/ruby-2.3.0/gems/rspec-core-3.7.0/lib:/usr/local/rvm/gems/ruby-2.3.0/gems/rspec-support-3.7.0/lib /usr/local/rvm/gems/ruby-2.3.0/gems/rspec-core-3.7.0/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
Could not load dummy application. Please ensure you have run `bundle exec rake test_app`
** Execute default
你们有谁知道问题的原因是什么,我应该怎么做?
Rakefile
require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rspec/core/rake_task'
require 'spree/testing_support/common_rake'
RSpec::Core::RakeTask.new
task default: :spec
desc "Generates a dummy app for testing"
task :test_app do
ENV['LIB_NAME'] = 'spree/frontend'
Rake::Task['common:test_app'].invoke
end
【问题讨论】:
-
什么版本的 Rails?还有 rvm?
-
你的 rakefile 看起来很奇怪。将这些
require File.expand_path('../config/application', __FILE__)和YouApp::Application.load_tasks添加到您的 Rakefile -
@nattfodd 你能把这个添加为答案吗?
标签: ruby-on-rails rake spree