首页 > 解决方案 > 使用 AWS Elastic Beanstalk 和资产部署 Rails 6

问题描述

我正在将 rails 6.x 应用程序部署到 AWS 弹性 beanstalk,但无法编译资产。

我继续看到以下错误:

ActionView::Template::Error (Webpacker can't find application in /var/app/current/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:
{
}
):

在我的 .ebextensions 目录中用于 rails setup config 的 container_commands 中,我有以下内容:

container_commands:
07_yarn_install:
command: "yarn install --check-files --force --production"
08_install_weback:
command: "sudo npm install --save-dev webpack"
09_install_babel:
command: "sudo npm install --save-dev babel-loader"
10_webpack:
command: "bundle exec rails webpacker:install"
11_asset_precompile:
command: "RAILS_ENV=production bundle exec rake assets:precompile"

标签: ruby-on-railsamazon-elastic-beanstalk

解决方案


推荐阅读