当我尝试从部署在 Heroku 上的网站访问页面时,出现错误:
ActionView::Template::Error (Webpacker can't find application.js in /app/public/packs/manifest.json`
这是它向我展示的解决方案:
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.
Your manifest contains:
{
}
):
8: <%= stylesheet_pack_tag "application", media: 'all', 'data-turbolinks-track': 'reload' %>
9: <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css">
10:
11: <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
12: <script src="https://js.stripe.com/v3/"></script>
13:
14: <%= favicon_link_tag asset_path('favicon.ico') %>
让我感到惊讶的是, list 中似乎有一些东西,但它只是被添加在括号之后。很想看看是否有人可以告诉我这是否是这里的问题以及如何解决它。
最佳答案
复制文件后尝试运行:
bundle exec rake assets:precompile
我用一个空的覆盖了 manifest.json。
关于ruby-on-rails - Webpacker list 为空,样式加载后,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66936707/