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

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

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

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

Ruby

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

Ruby on Rails 6

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

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Ruby on Rails

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

Q&A

解決済

2回答

971閲覧

git push heroku ができない

takuma_lol

総合スコア0

Ruby on Rails 5

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

Ruby

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

Ruby on Rails 6

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

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Ruby on Rails

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

0グッド

0クリップ

投稿2021/04/29 16:53

編集2021/04/29 16:54

前提・実現したいこと

railsチュートリアルに取り組んでいるのですが(現在6章終了段階)、git push herokuに成功しません。
7章からは本番環境を使用するそうなので、質問させていただきました。

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

git push herokuに失敗する。 Compilation failed: remote: [webpack-cli] Failed to load '/tmp/build_085863bf/config/webpack/production.js' config remote: [webpack-cli] TypeError: Cannot read property 'toWebpackConfig' of undefined remote: at Object.<anonymous> (/tmp/build_085863bf/config/webpack/production.js:5:30) remote: at Module._compile (/tmp/build_085863bf/node_modules/v8-compile-cache/v8-compile-cache.js:192:30) remote: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10) remote: at Module.load (internal/modules/cjs/loader.js:1000:32) remote: at Function.Module._load (internal/modules/cjs/loader.js:899:14) remote: at Module.require (internal/modules/cjs/loader.js:1042:19) remote: at require (/tmp/build_085863bf/node_modules/v8-compile-cache/v8-compile-cache.js:159:20) remote: at loadConfig (/tmp/build_085863bf/node_modules/webpack-cli/lib/webpack-cli.js:1322:31) remote: at /tmp/build_085863bf/node_modules/webpack-cli/lib/webpack-cli.js:1409:74 remote: at Array.map (<anonymous>) remote: 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: f78e5846c7b08e015838c212e1d4b0143b159610 remote: ! remote: ! We have detected that you have triggered a build from source code with version f78e5846c7b08e015838c212e1d4b0143b159610 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 stark-fjord-99600. remote: To https://git.heroku.com/stark-fjord-99600.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/stark-fjord-99600.git'

該当のソースコード

ubuntu:~/environment/sample_app (master) $ git push heroku ... remote: Compiling… remote: Compilation failed: remote: [webpack-cli] Failed to load '/tmp/build_085863bf/config/webpack/production.js' config remote: [webpack-cli] TypeError: Cannot read property 'toWebpackConfig' of undefined remote: at Object.<anonymous> (/tmp/build_085863bf/config/webpack/production.js:5:30) remote: at Module._compile (/tmp/build_085863bf/node_modules/v8-compile-cache/v8-compile-cache.js:192:30) remote: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10) remote: at Module.load (internal/modules/cjs/loader.js:1000:32) remote: at Function.Module._load (internal/modules/cjs/loader.js:899:14) remote: at Module.require (internal/modules/cjs/loader.js:1042:19) remote: at require (/tmp/build_085863bf/node_modules/v8-compile-cache/v8-compile-cache.js:159:20) remote: at loadConfig (/tmp/build_085863bf/node_modules/webpack-cli/lib/webpack-cli.js:1322:31) remote: at /tmp/build_085863bf/node_modules/webpack-cli/lib/webpack-cli.js:1409:74 remote: at Array.map (<anonymous>) remote: 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: f78e5846c7b08e015838c212e1d4b0143b159610 remote: ! remote: ! We have detected that you have triggered a build from source code with version f78e5846c7b08e015838c212e1d4b0143b159610 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 stark-fjord-99600. remote: To https://git.heroku.com/stark-fjord-99600.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/stark-fjord-99600.git'

試したこと

/config/applicaiton.rbにconfig.assets.initialize_on_precompile = falseを追加しましたが、改善は見られませんでした。

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

AWS cloud9を使用しています。

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

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

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

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

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

guest

回答2

0

自己解決

step1:
/config/webpacker.ymlにおけるwebpack_compile_outputをfalse => trueに変更
この操作で[webpack-cli]Failed to load...のエラーが消えました。
[webpack-cli] Error [BrowserlistError]が残っているので、step2でこのエラーを解消します。

step2:
package.json から browserlist を消去します。

以上で正常にデプロイが完了しました。

投稿2021/05/06 09:04

takuma_lol

総合スコア0

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

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

0

remote: ! This article goes into details on the behavior: remote: ! https://devcenter.heroku.com/articles/duplicate-build-version

エラーの内容を説明したURLがあるので読みましょう。

投稿2021/04/29 19:20

mather

総合スコア6753

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問