LoginSignup
2
0

More than 3 years have passed since last update.

Webpacker::Manifest::MissingEntryError

Last updated at Posted at 2021-01-11
rails generate controller home top

などのコマンドで適当に作成したページを開くと、以下のエラーが発生。
スクリーンショット 2021-01-04 21.58.22.png

ターミナル上は以下の表示。


Webpacker can't find application in アプリ名/public/packs/manifest.json. Possible causes:
1. You want to set webpacker.yml value of compile to true for your environment
   unless you are using the `webpack -w` or the webpack-dev-server.
2. webpack has not yet re-run to reflect updates.
3. You have misconfigured Webpacker's config/webpacker.yml file.
4. Your webpack configuration is not creating a manifest.

・manifest.jsonが見つからない。
・views/layouts内のapplication.html.erbの9行目がおかしい。

この2点を解決するために色々調べて試したが、改善せず。
調べた記事の中に、nodeのverが関係しているんじゃないかな〜的な物があったので、nodeのverを変更するついでに、webpacker installのために導入したnode,yarnやらを再installしてみた。
node verは最新版から、stableでinstallしたv14.15.4に変更。
下記の手順で実行すると、解決できました。

1.nodeのver変更するため、homebrewで管理しているnodeをuninstall。
  (homebrewでnodeのver変更する方法がわからなかったので。)
  nodebrewでstable版を再インストール。
2.yarn/icu4cも一旦uninstall。再度homebrewでインストール
  ※nodeはnodebrewでinstall済みのため、--ignore-dependencies オプションをつけること。

brew install yarn --ignore-dependencies

icu4cは--ignore-dependencies不要。

brew install icu4c

3.rails newで新しいプロジェクトを作成。
  このときすでにnode,yarn,icu4cがinstallされていれば、勝手にwebpackerもinstallされる。
4.rails sして、適当に作成したページを確認するとエラー発生せず。

これのせいで全く作業が進まなかったので改善してほんと良かった。

rails6以降は標準でwebpackerが導入されるようで、私のrailsもv6.0.3.4です。
今回の原因は、nodeのverの相性が悪かったのかな〜と思っていますが、そういうことにしときます。

2
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
2
0