本文介绍了Heroku部署上的Webpack错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在本地运行我的Rails应用程序效果很好。然后我将其成功部署到Heroku,但是在打开应用程序时出现错误:
Running my rails app locally works fine. Then I deployed it to Heroku successfully but when opening the app I get the error:
很抱歉,出了点问题。
如果您是应用程序所有者,请检查日志以获取更多信息。
我是第一次使用Heroku,这是我第一次部署的应用程序,因此并不完全确保一切正常。在我的heroku日志中,它说:
I'm new to using Heroku, this is my first deployed app so not completely sure of how everything works. In my heroku logs it says that:
- 您想将webpacker.yml的compile值设置为true您的环境
- Webpack尚未重新运行以反映更新。
- 您错误地配置了Webpacker的config / webpacker.yml文件。
webpack -w
或webpack-dev-server。 - 您的Webpack配置未创建清单。
- You want to set webpacker.yml value of compile to true for your environment
- Webpack has not yet re-run to reflect updates.
- You have misconfigured Webpacker's config/webpacker.yml file. unless you are using the
webpack -w
or the webpack-dev-server. - Your Webpack configuration is not creating a manifest.
遇到相同问题或有任何技巧尝试解决此问题的任何人?
Anyone that has had the same problem or has any tips on how to try and solve this?
这是整个heroku日志:
2017-11-19T12:30:56.336758+00:00 app[web.1]: I, [2017-11-19T12:30:56.336675 #4] INFO -- : [0b584fb1-2c9e-41e9-bfe4-19cbf6523a6c] Started GET "/" for 85.228.31.12 at 2017-11-19 12:30:56 +0000
2017-11-19T12:30:56.338912+00:00 app[web.1]: I, [2017-11-19T12:30:56.338848 #4] INFO -- : [0b584fb1-2c9e-41e9-bfe4-19cbf6523a6c] Rendered react_view/index.html.erb within layouts/application (0.7ms)
2017-11-19T12:30:56.337434+00:00 app[web.1]: I, [2017-11-19T12:30:56.337362 #4] INFO -- : [0b584fb1-2c9e-41e9-bfe4-19cbf6523a6c] Processing by ReactViewController#index as HTML
2017-11-19T12:30:56.338062+00:00 app[web.1]: I, [2017-11-19T12:30:56.337995 #4] INFO -- : [0b584fb1-2c9e-41e9-bfe4-19cbf6523a6c] Rendering react_view/index.html.erb within layouts/application
2017-11-19T12:30:56.339074+00:00 app[web.1]: I, [2017-11-19T12:30:56.339014 #4] INFO -- : [0b584fb1-2c9e-41e9-bfe4-19cbf6523a6c] Completed 500 Internal Server Error in 2ms
2017-11-19T12:30:56.339692+00:00 app[web.1]: F, [2017-11-19T12:30:56.339632 #4] FATAL -- : [0b584fb1-2c9e-41e9-bfe4-19cbf6523a6c]
2017-11-19T12:30:56.339766+00:00 app[web.1]: F, [2017-11-19T12:30:56.339696 #4] FATAL -- : [0b584fb1-2c9e-41e9-bfe4-19cbf6523a6c] ActionView::Template::Error (Webpacker can't find application.css in /app/public/packs/manifest.json. Possible causes:
2017-11-19T12:30:56.339768+00:00 app[web.1]: 1. You want to set webpacker.yml value of compile to true for your environment
2017-11-19T12:30:56.339770+00:00 app[web.1]: 2. Webpack has not yet re-run to reflect updates.
2017-11-19T12:30:56.339771+00:00 app[web.1]: 3. You have misconfigured Webpacker's config/webpacker.yml file.
2017-11-19T12:30:56.339769+00:00 app[web.1]: unless you are using the `webpack -w` or the webpack-dev-server.
2017-11-19T12:30:56.339772+00:00 app[web.1]: 4. Your Webpack configuration is not creating a manifest.
2017-11-19T12:30:56.339974+00:00 app[web.1]: [0b584fb1-2c9e-41e9-bfe4-19cbf6523a6c] 3: <%= javascript_pack_tag 'application' %>
2017-11-19T12:30:56.340038+00:00 app[web.1]: F, [2017-11-19T12:30:56.339975 #4] FATAL -- : [0b584fb1-2c9e-41e9-bfe4-19cbf6523a6c]
2017-11-19T12:30:56.340104+00:00 app[web.1]: F, [2017-11-19T12:30:56.340050 #4] FATAL -- : [0b584fb1-2c9e-41e9-bfe4-19cbf6523a6c] app/views/react_view/index.html.erb:2:in `_app_views_react_view_index_html_erb___547572771215860275_34419720'
2017-11-19T12:30:56.339974+00:00 app[web.1]: [0b584fb1-2c9e-41e9-bfe4-19cbf6523a6c] 4: <%= javascript_pack_tag 'ReactHome' %>
2017-11-19T12:30:56.339773+00:00 app[web.1]: Your manifest contains:
2017-11-19T12:30:56.339775+00:00 app[web.1]: }
2017-11-19T12:30:56.339774+00:00 app[web.1]: {
2017-11-19T12:30:56.339775+00:00 app[web.1]: ):
2017-11-19T12:30:56.339972+00:00 app[web.1]: F, [2017-11-19T12:30:56.339903 #4] FATAL -- : [0b584fb1-2c9e-41e9-bfe4-19cbf6523a6c] 1: <script>window.__theme = 'bs4';</script>
2017-11-19T12:30:56.339973+00:00 app[web.1]: [0b584fb1-2c9e-41e9-bfe4-19cbf6523a6c] 2: <%= stylesheet_pack_tag 'application' %>
`
推荐答案
我遇到了此错误,尝试进行编译,并得到了以下消息:
I had this error, tried to compile and also got :
$ rake assets:precompile RAILS_ENV=production
...
rails aborted!
No such middleware to insert after: ActionDispatch::Static
解决了它,谢谢带有ENV
Solved it thanks to this thread by turning with an ENV
# config/environments/production.rb
config.public_file_server.enabled=true` # ENV['RAILS_SERVE_STATIC_FILES'].present?
这篇关于Heroku部署上的Webpack错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!