阿吽n*_*o呼吸 15 ruby-on-rails webpack webpacker
Rails 6.0.0
Ruby 2.6.0
Amazon Linux2
Run Code Online (Sandbox Code Playgroud)

当我部署 Rails 应用程序时,会发生此错误
ActionView::Template::Error (Webpacker can't find application in /home/web/www/eloop-regular/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.
Run Code Online (Sandbox Code Playgroud)
webpack -wwebpack-dev-server 或 webpack-dev-server,否则您希望为您的环境将 compile 的 webpacker.yml 值设置为 true 。我的 config/webpacker.yml 包含
production:
<<: *default
# Production depends on precompilation of packs prior to booting for performance.
compile: true
# Extract and emit a css file
extract_css: true
# Cache manifest.json for performance
cache_manifest: true
Run Code Online (Sandbox Code Playgroud)
我跑
$ RAILS_ENV=production bundle exec rails webpacker:compile
Run Code Online (Sandbox Code Playgroud)
在开发环境中 webpacker 工作正常。
manifest.json 已创建
删除 Webpacker:
rm -rf bin/webpack*
Run Code Online (Sandbox Code Playgroud)
安装 Webpacker:
rails webpacker:install
Run Code Online (Sandbox Code Playgroud)
通过Webpacker以production模式编译:
RAILS_ENV=production rails webpacker:compile
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9917 次 |
| 最近记录: |