gpt4 book ai didi

ruby-on-rails - 无法运行 heroku rake db :migrate getting rake aborted! 错误

转载 作者:数据小太阳 更新时间:2023-10-29 08:48:46 24 4
gpt4 key购买 nike

我能够推送到 heroku,现在我需要迁移数据库,但我遇到错误 rake aborted!

我运行了命令 heroku rake db:migrate,我的命令行错误是

WARNING: `heroku rake` has been deprecated. Please use `heroku run rake` instead.
Running `rake db:migrate` attached to terminal... up, run.6184
rake aborted!
uninitialized constant MiniTest::Rails
/app/vendor/bundle/ruby/2.0.0/gems/minitest-4.7.5/lib/minitest/unit.rb:19:in `const_missing'
/app/Rakefile:9:in `<top (required)>'
(See full trace by running task with --trace)

然后我运行命令

Running `rake db:migrate` attached to terminal... up, run.8495
rake aborted!
uninitialized constant MiniTest::Rails
/app/vendor/bundle/ruby/2.0.0/gems/minitest-4.7.5/lib/minitest/unit.rb:19:in `const_missing'
/app/Rakefile:9:in `<top (required)>'
(See full trace by running task with --trace)

这是我的 Rakefile 的副本

#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)
require 'rake/dsl_definition'
require 'rake'

Portfolio::Application.load_tasks

MiniTest::Rails::Testing.default_tasks << "features"

这也是我的 Gemfile 的副本

 group :development, :test do
gem "minitest-rails"
gem 'sqlite3'
end

group :production do
gem 'pg'
gem 'rails_12factor'
end




group :test do
gem "minitest-rails-capybara"
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby

gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'

有人知道我的问题是什么以及为什么我不能迁移到 heroku 吗?

最佳答案

您的 gemfile 在 :test 组中只有 minitest,这很好,但是您的 rake 文件试图使用 MiniTest 类。试试这个:

if Rails.env == "test"
MiniTest::Rails::Testing.default_tasks << "features"
end

关于ruby-on-rails - 无法运行 heroku rake db :migrate getting rake aborted! 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19324308/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com