Webpacker 在manifest.json 中找不到application.js Heroku Production

2024-03-23

我在 heroku 上的应用程序遇到了 webpacker 问题。

The log:

ActionView::Template::Error (Webpacker can't find application.js in /app/public/packs/manifest.json. Possible causes:
2018-07-04T18:47:08.192729+00:00 app[web.1]: 1. You want to set webpacker.yml value of compile to true for your environment
2018-07-04T18:47:08.192730+00:00 app[web.1]:    unless you are using the `webpack -w` or the webpack-dev-server.
2018-07-04T18:47:08.192733+00:00 app[web.1]: 2. webpack has not yet re-run to reflect updates.
2018-07-04T18:47:08.192734+00:00 app[web.1]: 3. You have misconfigured Webpacker's config/webpacker.yml file.
2018-07-04T18:47:08.192735+00:00 app[web.1]: 4. Your webpack configuration is not creating a manifest.
2018-07-04T18:47:08.192737+00:00 app[web.1]: Your manifest contains:
2018-07-04T18:47:08.192738+00:00 app[web.1]: {
2018-07-04T18:47:08.192740+00:00 app[web.1]: }
2018-07-04T18:47:08.192741+00:00 app[web.1]: ):

我有一个manifest.json文件包含application.js:

{
  "application.css": "/packs/application-c922057d6b9db34084d6e52c6f32baa9.css",
  "application.css.map": "/packs/application-c922057d6b9db34084d6e52c6f32baa9.css.map",
  "application.js": "/packs/application-ab33c1479403810d7775.js",
  "application.js.map": "/packs/application-ab33c1479403810d7775.js.map"
}

日志中的最后一行很有趣:

2018-07-04T18:47:08.192737+00:00 app[web.1]: Your manifest contains:
2018-07-04T18:47:08.192738+00:00 app[web.1]: {
2018-07-04T18:47:08.192740+00:00 app[web.1]: }

json 中的格式是否有错误?

我尝试过跑步bundle exec rails webpacker:compile很好,我还更新了 binstubbundle exec rails webpacker:binstubs,在推送到 Heroku 后似乎都没有产生任何影响。

我还能尝试什么?


  • 我删除了文件夹node_modules
  • 然后在终端上yarn add @rails/webpacker@next
  • then bundle exec rails webpacker:install

之后,它就固定了

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Webpacker 在manifest.json 中找不到application.js Heroku Production 的相关文章

随机推荐