LoginSignup
imperish
@imperish

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

初心者エンジニア render.comで実装させたい のにActionView::Template::Error: Webpacker can't find application in..

render.comにデプロイしようとしたところ、webpackerにまつわるエラーが出ました

ActionView::Template::Error: Webpacker can't find application in..

下記リンクの方と同じエラーです
https://qiita.com/yuuu1654/items/76c3066bc0d72fdc0539
そして私はこのリンクを基に解決し先に進んだのですが、
この方も言及しているように根本的な解決ではないです。
思い返して原因を探ってみました。

すると下記リンクのような記事を見つけました
https://prograshi.com/framework/rails/webpackermanifestmissingentryerror/
ここには「webpackでコンパイルしていない」ことが原因と言っています。
これが原因でしょうか。
それともこれが原因とは限らないのでしょうか。
rails assets:precompile
を実行して見ましたが、cloud9のproduction環境では動くようになりました。
render.comに実装すると、やはり、動きません。

※ちなみにrender.comの方でも<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>を消すと動きます

shの書き方が間違ってる?

render-build.shの中身


set -o errexit

bundle install
yarn install
yarn build 
bundle exec rails webpacker:install
bundle exec rails assets:precompile 
bundle exec rails db:migrate

実際のエラー文

Dec 24 08:11:14 AM  [a69852ad-c818-4548-8fae-ed128bea84e7] ActionView::Template::Error (Webpacker can't find application in /opt/render/project/src/public/packs/manifest.json. Possible causes:
Dec 24 08:11:14 AM  1. You want to set webpacker.yml value of compile to true for your environment
Dec 24 08:11:14 AM     unless you are using the `webpack -w` or the webpack-dev-server.
Dec 24 08:11:14 AM  2. webpack has not yet re-run to reflect updates.
Dec 24 08:11:14 AM  3. You have misconfigured Webpacker's config/webpacker.yml file.
Dec 24 08:11:14 AM  4. Your webpack configuration is not creating a manifest.
Dec 24 08:11:14 AM  Your manifest contains:
Dec 24 08:11:14 AM  {
Dec 24 08:11:14 AM  }
Dec 24 08:11:14 AM  ):
Dec 24 08:11:14 AM  [a69852ad-c818-4548-8fae-ed128bea84e7]      6:     <%= csp_meta_tag %>
Dec 24 08:11:14 AM  [a69852ad-c818-4548-8fae-ed128bea84e7]      7:
Dec 24 08:11:14 AM  [a69852ad-c818-4548-8fae-ed128bea84e7]      8:    <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
Dec 24 08:11:14 AM  [a69852ad-c818-4548-8fae-ed128bea84e7]      9:    <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
Dec 24 08:11:14 AM  [a69852ad-c818-4548-8fae-ed128bea84e7]     10:   </head>
Dec 24 08:11:14 AM  [a69852ad-c818-4548-8fae-ed128bea84e7]     11:
Dec 24 08:11:14 AM  [a69852ad-c818-4548-8fae-ed128bea84e7]     12:   </head>
Dec 24 08:11:14 AM  [a69852ad-c818-4548-8fae-ed128bea84e7]
Dec 24 08:11:14 AM  [a69852ad-c818-4548-8fae-ed128bea84e7] app/views/layouts/application.html.erb:9

今怪しいと思っているところ。

Your manifest contains:
Dec 24 08:11:14 AM  {
Dec 24 08:11:14 AM  }

これって空っぽってことですよね。
manifestの中身はからっぽでいいんですか?

駄文ですみません。
ご回答お待ちしております。
よろしくお願いします。

0

No Answers yet.

Your answer might help someone💌