在heroku上部署Rails失败,Rails无法从数据库中推断您是否正在使用多个数据库,yml

bqucvtff  于 2022-11-13  发布在  其他
关注(0)|答案(1)|浏览(106)

我在Heroku上部署Rails应用程序时,部署失败并显示此错误消息。

Rails couldn't infer whether you are using multiple databases from your database.yml and can't generate the tasks for the non-primary databases. If you'd like to use this feature, please simplify your ERB.

我已经在Heroku上连续部署了一年多,没有做出任何重大改变。
变更涉及将gem文件从ruby“2.6.3”更新为ruby“3.1.2”。
这是完整的轨迹

Building on the Heroku-22 stack
Using buildpacks:
       1. heroku/ruby
       2. heroku/nodejs
Ruby app detected
Installing bundler 2.3.10
Removing BUNDLED WITH version in the Gemfile.lock
Compiling Ruby/Rails
###### WARNING:
       Your app was upgraded to bundler 2.3.10.
       Previously you had a successful deploy with bundler 2.2.21.
       
       If you see problems related to the bundler version please refer to:
       https://devcenter.heroku.com/articles/bundler-version#known-upgrade-issues
       
Using Ruby version: ruby-3.1.2
       Purging Cache. Changing stack from heroku-18 to heroku-22
Installing dependencies using bundler 2.3.10
       Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4

    A bunch of gems fetching and installing

       Bundle complete! 22 Gemfile dependencies, 78 gems now installed.
       Gems in the groups 'development' and 'test' were not installed.
       Bundled gems are installed into `./vendor/bundle`
       Post-install message from mailjet:
       
         The Ruby wrapper for Mailjet has just been installed successfully, congrats!
         Maybe you want to configure your credentials to use your account.
         All informations available on https://github.com/mailjet/mailjet-gem.
         But if you are using Rails, you'll be glad to generate it easily using:
       
           $ rails generate mailjet:initializer
       
         We hope you will enjoy Mailjet!
       
       Bundle completed (86.70s)
       Cleaning up the bundler cache.
Installing node-v16.13.1-linux-x64
Installing yarn-v1.22.17
Detecting rake tasks
Preparing app for Rails asset pipeline

       Running: rake assets:precompile
       Rails couldn't infer whether you are using multiple databases from your database.yml and can't generate the tasks for the non-primary databases. If you'd like to use this feature, please simplify your ERB.
       rake aborted!
       Psych::BadAlias: Unknown alias: default

       /tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/webpacker-4.3.0/lib/webpacker/env.rb:30:in `available_environments'
       /tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/webpacker-4.3.0/lib/webpacker/env.rb:21:in `current'
       /tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/webpacker-4.3.0/lib/webpacker/env.rb:15:in `inquire'
       /tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/webpacker-4.3.0/lib/webpacker/env.rb:7:in `inquire'
       /tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/webpacker-4.3.0/lib/webpacker/instance.rb:11:in `env'
       /tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/webpacker-4.3.0/lib/webpacker/instance.rb:18:in `config'
       /tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/webpacker-4.3.0/lib/webpacker.rb:34:in `config'
       /tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/webpacker-4.3.0/lib/webpacker/railtie.rb:32:in `block in <class:Engine>'
       /tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/railties-6.0.5.1/lib/rails/initializable.rb:32:in `instance_exec'
       /tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/railties-6.0.5.1/lib/rails/initializable.rb:32:in `run'
       /tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/railties-6.0.5.1/lib/rails/initializable.rb:61:in `block in run_initializers'
       /tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/railties-6.0.5.1/lib/rails/initializable.rb:60:in `run_initializers'
       /tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/railties-6.0.5.1/lib/rails/application.rb:363:in `initialize!'
       /tmp/build_f6d25fed/config/environment.rb:5:in `<main>'
       /tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
       /tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
       /tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:35:in `require'
       /tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/activesupport-6.0.5.1/lib/active_support/dependencies.rb:324:in `block in require'
       /tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/activesupport-6.0.5.1/lib/active_support/dependencies.rb:291:in `load_dependency'
       /tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/activesupport-6.0.5.1/lib/active_support/dependencies.rb:324:in `require'
       /tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/railties-6.0.5.1/lib/rails/application.rb:339:in `require_environment!'
       /tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/railties-6.0.5.1/lib/rails/application.rb:523:in `block in run_tasks_blocks'
       /tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/task.rb:61:in `block (2 levels) in define'
       Tasks: TOP => environment
       (See full trace by running task with --trace)
 !
 !     Precompiling assets failed.
 !
 !     Push rejected, failed to compile Ruby app.
 !     Push failed
qxsslcnc

qxsslcnc1#

这是一个与新的Ruby版本的兼容性问题,只是添加了精神宝石修复了这一点。

gem 'psych', '< 4'

相关问题