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

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

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

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

Git

Gitはオープンソースの分散バージョン管理システム(DVCS)です。

Heroku

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

バージョン管理

バージョン管理はコンピューター上にファイルとして格納されているドキュメント・プログラム・その他の情報の変更履歴等を管理するものです

Q&A

0回答

1376閲覧

error Command "webpack" not found. というエラーのためHerokuへデプロイできない

kiriririn

総合スコア0

Ruby on Rails 6

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

Git

Gitはオープンソースの分散バージョン管理システム(DVCS)です。

Heroku

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

バージョン管理

バージョン管理はコンピューター上にファイルとして格納されているドキュメント・プログラム・その他の情報の変更履歴等を管理するものです

0グッド

0クリップ

投稿2022/02/15 09:58

編集2022/02/15 11:18

前提・実現したいこと

Rails チュートリアル1章「1.5.2Herokuにデプロイする(1)」にて 

$ git push heroku main

とpushしたところ、
見出しに記載した
error Command "webpack" not found.
というエラーが出てしまいました。

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

webpackerに問題があるようです
このエラーを解消しherokuへhello_appをデプロイしたいです。

cloud9

1error Command "webpack" not found.

該当のソースコード

git push heroku main を行った結果

cloud9

1remote: I, [2022-02-15T07:43:40.032328 #995] INFO -- : Writing /tmp/build_9c31f45d/public/assets/application-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css 2remote: I, [2022-02-15T07:43:40.032834 #995] INFO -- : Writing /tmp/build_9c31f45d/public/assets/application-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css.gz 3remote: Compiling… 4remote: Compilation failed: 5remote: error Command "webpack" not found. 6remote: 7remote: yarn run v1.22.17 8remote: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. 9remote: 10remote: 11remote: ! 12remote: ! Precompiling assets failed. 13remote: ! 14remote: ! Push rejected, failed to compile Ruby app. 15remote: 16remote: ! Push failed 17remote: ! 18remote: ! ## Warning - The same version of this code has already been built: c6ece086db716bba11cb7628ce1f12bba063bca2 19remote: ! 20remote: ! We have detected that you have triggered a build from source code with version c6ece086db716bba11cb7628ce1f12bba063bca2 21remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch. 22remote: ! 23remote: ! If you are developing on a branch and deploying via git you must run: 24remote: ! 25remote: ! git push heroku <branchname>:main 26remote: ! 27remote: ! This article goes into details on the behavior: 28remote: ! https://devcenter.heroku.com/articles/duplicate-build-version 29remote: 30remote: Verifying deploy... 31remote: 32remote: ! Push rejected to calm-ravine-40757. 33remote: 34To https://git.heroku.com/calm-ravine-40757.git 35 ! [remote rejected] main -> main (pre-receive hook declined) 36error: failed to push some refs to 'https://git.heroku.com/ファイル名

herokuのBuild Log

Heroku

1 Cleaning up the bundler cache. 2-----> Installing node-v16.13.1-linux-x64 3-----> Installing yarn-v1.22.17 4-----> Detecting rake tasks 5-----> Preparing app for Rails asset pipeline 6 Running: rake assets:precompile 7 yarn install v1.22.17 8 [1/4] Resolving packages... 9 [2/4] Fetching packages... 10 [3/4] Linking dependencies... 11 warning " > webpack-dev-server@4.7.4" has unmet peer dependency "webpack@^4.37.0 || ^5.0.0". 12 warning "webpack-dev-server > webpack-dev-middleware@5.3.1" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0". 13 [4/4] Building fresh packages... 14 Done in 3.09s. 15 I, [2022-02-15T07:43:40.032328 #995] INFO -- : Writing /tmp/build_9c31f45d/public/assets/application-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css 16 I, [2022-02-15T07:43:40.032834 #995] INFO -- : Writing /tmp/build_9c31f45d/public/assets/application-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css.gz 17 Compiling… 18 Compilation failed: 19 error Command "webpack" not found. 20 21 yarn run v1.22.17 22 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. 23 24 ! 25 ! Precompiling assets failed. 26 ! 27 ! Push rejected, failed to compile Ruby app. 28 ! Push failed

heroku logsをターミナルで行った結果

cloud9

12022-02-15T07:43:41.000000+00:00 2app[api]: Build failed -- check your build output: 3https://dashboard.heroku.com/apps/17478130-4bba-4e1b-8351-16aeeaeeeb2e/activity/builds/c4eede60-ba6c-4553-a45d-47efeb24e1d0

試したこと

検索ワード

「rails チュートリアル error command "webpack" not found」
「error command "webpack" not found」
「heroku デプロイできない」
「heroku デプロイ エラー」

Railsチュートリアルには今回のエラーに対しての解決法が記載されていなかったので、上記の内容でGoogle検索をしました。

参照したサイト

https://ameblo.jp/arcadia-8160/entry-12679628014.html
→解決しませんでした

https://qiita.com/senba1007/questions/11ab73ef8e440cd30bd6
→回答記載のコードを試しましたが解決しませんでした

https://www.somethinggood.work/151
→解決しませんでした

最初から作り直した

再度1章の最初から作り直しました。
Railsチュートリアルのコードを全てコピペしたのですが、
再度デプロイの際に
error command "webpack" not found
というエラーが発生しました。

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

・ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
・Rails 6.0.3
・開発環境 AWS Cloud9

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

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

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

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

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

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問