Rails 6 生产 - Webpacker 在 manifest.json 中找不到样式

Rails 6 Production - Webpacker can't find styles in manifest.json

我正在尝试 运行 我的 rails 6 应用程序投入生产,但面临内部服务器错误。

当我检查日志时,这是我看到的:

ActionView::Template::Error (Webpacker can't find styles in /home/****/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.
Your manifest contains:
{
  "application.css": "/packs/css/application-8364df35.css",
  "application.js": "/packs/js/application-2789a226d9ddcf2c59d1.js",
  "application.js.map": "/packs/js/application-2789a226d9ddcf2c59d1.js.map",
  "entrypoints": {
    "application": {
      "css": [
        "/packs/css/application-8364df35.css"
      ],
      "js": [
        "/packs/js/application-2789a226d9ddcf2c59d1.js"
      ],
      "js.map": [
        "/packs/js/application-2789a226d9ddcf2c59d1.js.map"
      ]
    }
  }
}

当我检查服务器文件时,实际上所有内容都在那里。

我正在通过 Capistrano 进行部署,我的服务器设置是 nginx+puma。

尽管在本地主机上一切正常,但我无法 运行 在生产环境中使用服务器。有什么我想念的吗?

您的样式表“包”称为“应用程序”(不是“样式”)。

stylesheet_pack_tag ’styles’ 替换为 stylesheet_pack_tag ’application’