ruby-on-rails - 使用 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"
解决方案
推荐阅读
- c# - 如何统一禁用/启用特定的 EventTrigger
- python - Docker - 微服务公开使用 fast.ai 训练的 ml 模型
- android - 无法解决实施 - Android
- python - 创建 mongoengine 连接包装器以在多个模块中使用
- json - 使用 dataimport 将数据从 CSV、XML 或 Json 文件导入到 solr
- mysql - 如何使用mysql中的过程导出表数据
- reactjs - 如何在 fetch 中传递 POST 参数以在 React Native 中将图像上传到服务器?
- python-3.x - Keras VGG16 预训练模型准确率没有提高
- asp.net - ASP.NET MVC 防伪令牌 (CSRF) 不起作用
- django - Django:尝试过滤用户已接受的事件时未定义名称“请求”