質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Cloud9

Cloud9は、クラウドからのプログラミングが可能になるWebサービス。IDEとしての機能が搭載されており、GitHubやHerokuなど他ツールとの連携も可能です。ブラウザ上で動くため、デバイスに関係なく開発環境を準備できます。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails 6

Ruby on Rails 6は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

解決済

1回答

1346閲覧

git push heroku masterするとエラーでデプロイできず

masatto16

総合スコア1

Cloud9

Cloud9は、クラウドからのプログラミングが可能になるWebサービス。IDEとしての機能が搭載されており、GitHubやHerokuなど他ツールとの連携も可能です。ブラウザ上で動くため、デバイスに関係なく開発環境を準備できます。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails 6

Ruby on Rails 6は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2022/10/18 01:47

編集2022/10/18 02:19

railsチュートリアル「1.5.2 Herokuにデプロイする」にてcloud9よりruby on railsのアプリをHerokuへデプロイ(git push heroku master)する際にエラーが発生しデプロイできません。解決方法をご教示いただけると幸いです。

発生している問題・エラーメッセージ

git push heroku master Counting objects: 126, done. Compressing objects: 100% (108/108), done. Writing objects: 100% (126/126), 155.56 KiB | 3.62 MiB/s, done. Total 126 (delta 20), reused 0 (delta 0) remote: Compressing source files... done. remote: Building source: remote: remote: -----> Building on the Heroku-20 stack remote: -----> Determining which buildpack to use for this app remote: ! Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used. remote: Detected buildpacks: Ruby,Node.js remote: See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order remote: -----> Ruby app detected remote: -----> Installing bundler 2.3.10 remote: -----> Removing BUNDLED WITH version in the Gemfile.lock remote: -----> Compiling Ruby/Rails remote: -----> Using Ruby version: ruby-3.1.2 remote: -----> Installing dependencies using bundler 2.3.10 remote: Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4 remote: Fetching gem metadata from https://rubygems.org/.......... remote: Fetching rake 12.3.3 remote: Installing rake 12.3.3 remote: Fetching concurrent-ruby 1.1.10 〜中略〜 remote: Bundle complete! 18 Gemfile dependencies, 59 gems now installed. remote: Gems in the groups 'development' and 'test' were not installed. remote: Bundled gems are installed into `./vendor/bundle` remote: Post-install message from sass: remote: remote: Ruby Sass has reached end-of-life and should no longer be used. remote: remote: * If you use Sass as a command-line tool, we recommend using Dart Sass, the new remote: primary implementation: https://sass-lang.com/install remote: remote: * If you use Sass as a plug-in for a Ruby web framework, we recommend using the remote: sassc gem: https://github.com/sass/sassc-ruby#readme remote: remote: * For more details, please refer to the Sass blog: remote: https://sass-lang.com/blog/posts/7828841 remote: remote: Bundle completed (28.25s) remote: Cleaning up the bundler cache. remote: -----> Installing node-v16.13.1-linux-x64 remote: -----> Installing yarn-v1.22.17 remote: -----> Detecting rake tasks remote: -----> Preparing app for Rails asset pipeline remote: Running: rake assets:precompile remote: 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. remote: rake aborted! remote: Psych::BadAlias: Unknown alias: default 〜中略〜 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: 9f774684b10e4ae53ba64fdb3f667a90081da21c remote: ! remote: ! We have detected that you have triggered a build from source code with version 9f774684b10e4ae53ba64fdb3f667a90081da21c 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... remote: remote: ! Push rejected to thawing-beyond-55905. remote: To https://git.heroku.com/thawing-beyond-55905.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/thawing-beyond-55905.git'

試したこと

  • webpackerにまつわるエラーが出ていた為 bundle exec rails webpacker:install を実行

  • エラー原因を探る為heroku logs を実行するも解決に至らず

heroku logs Build failed -- check your build output: https://dashboard.heroku.com/apps/646b0e0b-383e-413e-8040-ab35861f719c/activity/builds/c08b5759-7fbd-40bc-a977-7b13f50dc5ee

上記ページへ移動、以下エラーを確認

-----> Building on the Heroku-20 stack -----> Determining which buildpack to use for this app ! 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 See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order -----> Ruby app detected -----> Installing bundler 2.3.10 -----> Removing BUNDLED WITH version in the Gemfile.lock -----> Compiling Ruby/Rails -----> Using Ruby version: ruby-3.1.2 -----> 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 Fetching gem metadata from https://rubygems.org/.......... Fetching rake 12.3.3 Installing rake 12.3.3 〜中略〜 Bundle complete! 18 Gemfile dependencies, 59 gems now installed. Gems in the groups 'development' and 'test' were not installed. Bundled gems are installed into `./vendor/bundle` Post-install message from sass: Ruby Sass has reached end-of-life and should no longer be used. * If you use Sass as a command-line tool, we recommend using Dart Sass, the new primary implementation: https://sass-lang.com/install * If you use Sass as a plug-in for a Ruby web framework, we recommend using the sassc gem: https://github.com/sass/sassc-ruby#readme * For more details, please refer to the Sass blog: https://sass-lang.com/blog/posts/7828841 Bundle completed (28.25s) 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_fd22df06/vendor/bundle/ruby/3.1.0 Tasks: TOP => environment (See full trace by running task with --trace) ! ! Precompiling assets failed. ! ! Push rejected, failed to compile Ruby app. ! Push failed
  • configファイルの修正

config/environment/development.rbにてconfig.file_watcher = ActiveSupport::EventedFileUpdateChecker
のコメントアウトで解決したとの記事があった為実施するも変わらず。
【参考】Gemfileのtest・development環境がinstallされない
https://teratail.com/questions/263378

補足情報(FW/ツールのバージョンなど)

ruby 2.7.6
Rails 6.0.4
node v14.19.0

宜しくお願い致します。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

こちらの記事を参考に作業を行ったところ解決しました。
https://unscrupulous-business-firm.com/2022/06/07/ruby-3-1-%E3%81%AB%E3%83%90%E3%83%BC%E3%82%B8%E3%83%A7%E3%83%B3%E3%82%A2%E3%83%83%E3%83%97%E6%99%82%E3%81%AE-unknown-alias-default-psychbadalias-%E5%AF%BE%E5%BF%9C/

以下エラーに注目しました。

Unknown alias: default (Psych::BadAlias)

調べると ライブラリの v3 と v4 で互換性がなくなったことが原因のようです。

config/database.yml

を修正しました。

修正前
adapter,pool,timeoutが共通項目としてdefaultでまとめて設定されています。

default: &default adapter: sqlite3 pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> timeout: 5000 development: <<: *default database: db/development.sqlite3 test: <<: *default database: db/test.sqlite3 production: <<: *default database: db/production.sqlite3

修正後
それを、エイリアスがデフォルト不可となったので以下のように修正しました。

development: adapter: sqlite3 pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> timeout: 5000 database: db/development.sqlite3 test: adapter: sqlite3 pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> timeout: 5000 database: db/test.sqlite3 production: adapter: sqlite3 pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> timeout: 5000 database: db/production.sqlite3

上記修正後、

bundle install git commit -a -m "Update Gemfile for Heroku" git push heroku master

を実行したところ、解決しました。

remote: -----> Compressing... remote: Done: 86.7M remote: -----> Launching... remote: Released v9 remote: https://thawing-beyond-55905.herokuapp.com/ deployed to Heroku 〜中略〜 remote: remote: Verifying deploy... done. To https://git.heroku.com/thawing-beyond-55905.git 3e1bc72..02ded56 master -> master

さらに、URLよりページを開くと以下画面でエラーが表示されましたが
イメージ説明

以下記事を参考に
https://zenn.dev/takuty/articles/eadd7eba7a54f0

以下のライブラリをインストールしデプロイするとエラーなく表示されました。

gem 'net-imap' gem 'net-pop' gem 'net-smtp'

投稿2022/10/18 15:54

編集2022/10/18 16:00
masatto16

総合スコア1

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問