简体   繁体   中英

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. I did include a dummy index.html.erb to Rails view.

application.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. This comment in Github was useful: https://github.com/rails/rails/pull/38820#issuecomment-604058068

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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