簡體   English   中英

使用 Rails 6 和 React 作為前端的 500 內部服務器錯誤

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

我有這個錯誤

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)

我使用 Rails 6 和 React 作為前端。 我確實在 Rails 視圖中包含了一個虛擬的index.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>

我在 Rails 6 和設計中遇到了類似的問題。 Github 中的這條評論很有用: https : //github.com/rails/rails/pull/38820#issuecomment-604058068

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM