环境
Rails 6.0.0
Ruby 2.6.0
Amazon Linux2
什么
当我部署我的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.
1. 如果您没有使用 webpack -w
或 webpack-dev-server,那么您需要将 webpacker.yml 的 compile 值设置为 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
2. Webpack尚未重新运行以反映更新。
我运行
$ RAILS_ENV=production bundle exec rails webpacker:compile
3. 您已经错误配置了Webpacker的config/webpacker.yml文件。
在开发环境中,Webpacker可以正常运行。
4. 您的webpack配置没有创建清单文件。
manifest.json文件未被创建。
yarn add @rails/webpacker
帮助我解决了这个问题。谢谢。 - NBash