herokuでデプロイしたい
Ruby on Railsでアルバイトを募集できるWebアプリをつくっています。
試しにherokuでデプロイしてみようとも思い作業していたのですがうまくできません。
よろしければお力をお貸しください。
発生している問題・エラーメッセージ
Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used. Detected buildpacks: Ruby,Node.js 中略 Preparing app for Rails asset pipeline Running: rake assets:precompile rake aborted! NoMethodError: undefined method `[]' for nil:NilClass 中略 Precompiling assets failed. Push rejected, failed to compile Ruby app.
エラーメッセージ
remote: Bundle completed (145.94s) remote: Cleaning up the bundler cache. remote: Removing bundler (2.2.21) remote: -----> Installing node-v12.16.2-linux-x64 remote: -----> Installing yarn-v1.22.4 remote: -----> Detecting rake tasks remote: -----> Preparing app for Rails asset pipeline remote: Running: rake assets:precompile remote: rake aborted! remote: NoMethodError: undefined method `[]' for nil:NilClass remote: /tmp/build_d54fb60d/config/initializers/devise.rb:27:in `block in <main>' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/devise-4.8.0/lib/devise.rb:307:in `setup' remote: /tmp/build_d54fb60d/config/initializers/devise.rb:11:in `<main>' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:326:in `block in load' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:326:in `load' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/railties-6.1.4.1/lib/rails/engine.rb:681:in `block in load_config_initializer' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/notifications.rb:205:in `instrument' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/railties-6.1.4.1/lib/rails/engine.rb:680:in `load_config_initializer' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/railties-6.1.4.1/lib/rails/engine.rb:634:in `block (2 levels) in <class:Engine>' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/railties-6.1.4.1/lib/rails/engine.rb:633:in `each' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/railties-6.1.4.1/lib/rails/engine.rb:633:in `block in <class:Engine>' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in `instance_exec' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in `run' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:61:in `block in run_initializers' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:50:in `each' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:50:in `tsort_each_child' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:60:in `run_initializers' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/railties-6.1.4.1/lib/rails/application.rb:391:in `initialize!' remote: /tmp/build_d54fb60d/config/environment.rb:5:in `<main>' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `block in require' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/railties-6.1.4.1/lib/rails/application.rb:367:in `require_environment!' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/railties-6.1.4.1/lib/rails/application.rb:533:in `block in run_tasks_blocks' remote: /tmp/build_d54fb60d/vendor/bundle/ruby/3.0.0/gems/sprockets-rails-3.2.2/lib/sprockets/rails/task.rb:61:in `block (2 levels) in define' remote: Tasks: TOP => environment remote: (See full trace by running task with --trace) remote: remote: ! remote: ! Precompiling assets failed. remote: ! remote: ! Push rejected, failed to compile Ruby app. remote: remote: ! Push failed remote: ! remote: ! ## Warning - The same version of this code has already been built: 5c943d94b57e7f07c6c3ab0484bf96167854683a remote: ! remote: ! We have detected that you have triggered a build from source code with version 5c943d94b57e7f07c6c3ab0484bf96167854683a remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch. remote: ! remote: ! If you are developing on a branch and deploying via git you must run: remote: ! remote: ! git push heroku <branchname>:main remote: ! remote: ! This article goes into details on the behavior: remote: ! https://devcenter.heroku.com/articles/duplicate-build-version remote: remote: Verifying deploy...
devise.rb
Devise.setup do |config| config.mailer_sender = Settings.gmail[:user_name] config.mailer_sender = '"Aiaru" <inf@aiaru.com>' require 'devise/orm/active_record' config.case_insensitive_keys = [:email] config.strip_whitespace_keys = [:email] config.skip_session_storage = [:http_auth] config.stretches = Rails.env.test? ? 1 : 12 config.reconfirmable = true config.expire_all_remember_me_on_sign_out = true config.password_length = 6..128 config.email_regexp = /\A[^@\s]+@[^@\s]+\z/ config.reset_password_within = 6.hours config.scoped_views = true config.sign_out_via = :delete end
試したこと
下記のコードをconfig/application.rb」に記入しました
config.assets.initialize_on_precompile = false
下記のコードを実行しました
RAILS_ENV=development bin/rails assets:precompile
その結果
Everything's up-to-date. Nothing to do
となりました。
下記のコードを実行しました
RAILS_ENV=production bin/rails assets:precompile
そのところ、
rails aborted!
NameError: uninitialized constant Rack::MiniProfiler
Did you mean? MiniMime
となったのですが、これの言っている意味がよく分かりません。
よろしくお願いいたします
補足情報(FW/ツールのバージョンなど)
mac
ruby 3.0.2
awsのs3を使っています。
あなたの回答
tips
プレビュー