Ruby on rails 生产环境中的Rails Webpacker编译错误 环境 什么

Ruby on rails 生产环境中的Rails Webpacker编译错误 环境 什么,ruby-on-rails,webpack,webpacker,Ruby On Rails,Webpack,Webpacker,当我部署rails应用程序时,会发生此错误 Rails 6.0.0 Ruby 2.6.0 Amazon Linux2 1.您希望为您的环境将compile的webpack.yml值设置为true,除非您使用的是webpack-w或webpack dev服务器。 my config/webpacker.yml包含 ActionView::Template::Error (Webpacker can't find application in /home/web/www/eloop-regular

当我部署rails应用程序时,会发生此错误

Rails 6.0.0
Ruby 2.6.0
Amazon Linux2
1.您希望为您的环境将compile的webpack.yml值设置为true,除非您使用的是
webpack-w
或webpack dev服务器。 my config/webpacker.yml包含

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.

3.您错误配置了Webpacker的config/Webpacker.yml文件。 在开发环境中,webpacker可以正常工作

4.您的网页包配置未创建清单。
manifest.json是创建的

我在运行预构建的rails 6应用程序时遇到了相同的问题。我发现这是因为warn.lock文件中的网页包版本不一致。 然后当我跑的时候

纱线添加@rails/webpacker

bundle更新webpacker

如图所示,问题已解决。

删除Webpacker:

$ RAILS_ENV=production bundle exec rails webpacker:compile
rm -rf bin/webpack*
安装Webpacker:

$ RAILS_ENV=production bundle exec rails webpacker:compile
rm -rf bin/webpack*
生产模式下由Webpacker编译:

rails webpacker:install