Rails 6 Production-Webpacker在manifest.json

时间:2019-12-07 16:30:38

标签: nginx webpack-dev-server webpacker ruby-on-rails-6

我正在尝试在生产环境中运行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。

尽管一切都可以在localhost上运行,但是我无法在生产环境中运行服务器。我有什么想念的吗?

1 个答案:

答案 0 :(得分:0)

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

stylesheet_pack_tag ’styles’替换为stylesheet_pack_tag ’application’