0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Rails】エラー 「Webpacker::Manifest::MissingEntryError in」を解決した経緯

0
Last updated at Posted at 2023-03-18

Rubyを初めて学習するために、Techpitのハンズオン講座にてRuby on railsのアプリ開発講座を受けていたところ、画面表示の段階で上記エラーで躓き、解決策が見つからなかったため、メモを記載する。

「Webpacker::Manifest::MissingEntryError in コントローラー名#アクション名」のエラーに遭遇

↓以下の記事を見ると原因は、webpackerをコンパイルしていないことのよう。

webpackerのコンパイルエラー

次にwebpackerをコンパイルしたところ、以下のエラーに遭遇。

コンパイルエラー

warning ../../package.json: No license field                                                                                                                    
Compiling...
Compilation failed:
yarn run v1.22.17
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.


warning ../../package.json: No license field
warning ../../package.json: No license field
error Command "webpack" not found.

↓解決策としては、以下がとても参考になりました。ありがとうございます。

まず、以下の順で実行した。
rails webpacker:installを以前打っていた場合は途中処理が止まる。
すでに作られているファイルとconflictを起こすため。全てEnterを押してOverWriteする。

1.rails webpacker:installを実行

2.リポジトリのnode_modulesを削除

3.public/packsを削除

4.yarn installを実行

5.bundleを実行

6.rails webpacker:installを実行

7.リポジトリのgemfileに記載の、webpackerを'~> 4.0'から'~>5.0'に変更。

8.bundleを実行

9.bundle exec rails webpacker:installを実行

10.bundle exec rails webpacker:compileを実行

11.rails s

通常は上記でエラー解決できるはずだが、更新内容が反映されなかったため、
rails restartを実行により、反映された!

以上、自分なりの解決策がみつかった。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?