简体   繁体   English

使用 Rails 6 和 React 作为前端的 500 内部服务器错误

[英]500 Internal Server Error with Rails 6 and React as front-end

I'm having this error我有这个错误

Started GET "/" for 127.0.0.1 at 2020-03-30 16:20:14 +0800
Processing by ProductsController#index as HTML
  Rendering products/index.html.erb within layouts/application
  Rendered products/index.html.erb within layouts/application (Duration: 0.3ms | Allocations: 70)
Completed 500 Internal Server Error in 45ms (ActiveRecord: 0.0ms | Allocations: 18735)

I'm using Rails 6 and React as the front-end.我使用 Rails 6 和 React 作为前端。 I did include a dummy index.html.erb to Rails view.我确实在 Rails 视图中包含了一个虚拟的index.html.erb

application.html.erb应用程序.html.erb

<!DOCTYPE html> 
<html> 
  <head> 
    <title>AnimeStore</title> 
    <%= csrf_meta_tags %> 
    <%= csp_meta_tag %> 
    <%= stylesheet_link_tag 'application', media: 'all' %> 
    <%= javascript_pack_tag 'application'%> 
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> 
    <%= javascript_pack_tag 'index' %> 
    <%= stylesheet_pack_tag 'index',media: 'all' %> 
  </head> 
  <body> <%= yield %> </body> 
</html>

I had a similar issue with Rails 6 and devise.我在 Rails 6 和设计中遇到了类似的问题。 This comment in Github was useful: https://github.com/rails/rails/pull/38820#issuecomment-604058068 Github 中的这条评论很有用: https : //github.com/rails/rails/pull/38820#issuecomment-604058068

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM