亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

MERN 應用程序部署到 heroku,一個空白頁面

MERN 應用程序部署到 heroku,一個空白頁面

皈依舞 2023-08-05 19:34:34
我通過使用 create-react-app 制作了一個非常簡單的 MERN 應用程序,沒有 mongo 數據庫。當我部署到 Heroku 時,我看到的只是一個空白頁面。我嘗試了很多事情但沒有運氣。API 正確發送電子郵件,頁面標題正確,但所有內容均丟失。請幫我看看,這是我的第一次部署。這是代碼: https: //github.com/samames/essae 這是部署:https://protected-wave-21372.herokuapp.com/非常感謝- 編輯 -這是日志:2020-11-13T18:00:38.000000+00:00 app[api]: Build succeeded2020-11-13T18:00:38.289382+00:00 heroku[web.1]: Stopping all processes with SIGTERM2020-11-13T18:00:38.395329+00:00 heroku[web.1]: Process exited with status 1432020-11-13T18:00:53.206813+00:00 heroku[web.1]: Starting process with command `node backend/index.js`2020-11-13T18:00:56.521645+00:00 app[web.1]: app listening at http://localhost:95082020-11-13T18:00:57.608133+00:00 heroku[web.1]: State changed from starting to up2020-11-13T18:01:03.750237+00:00 heroku[router]: at=info method=GET path="/" host=protected-wave-21372.herokuapp.com request_id=216189ff-cb13-4b39-8d8a-155df094c5b6 fwd="176.26.189.232" dyno=web.1 connect=1ms service=52ms status=200 bytes=2532 protocol=https2020-11-13T18:01:03.902311+00:00 heroku[router]: at=info method=GET path="/static/js/main.2940f24a.chunk.js" host=protected-wave-21372.herokuapp.com request_id=34237762-907b-4211-b154-8ee408429549 fwd="176.26.189.232" dyno=web.1 connect=16ms service=11ms status=200 bytes=2532 protocol=https2020-11-13T18:01:03.903848+00:00 heroku[router]: at=info method=GET path="/static/css/main.8c8b27cf.chunk.css" host=protected-wave-21372.herokuapp.com request_id=a1e4b2db-48b9-401c-9e4c-f0f4a3cfb84a fwd="176.26.189.232" dyno=web.1 connect=14ms service=13ms status=200 bytes=2532 protocol=https
查看完整描述

1 回答

?
catspeake

TA貢獻1111條經驗 獲得超0個贊

問題很簡單 - 靜態文件路徑中有拼寫錯誤。只需?將此行更改為app.use(express.static(path.join(__dirname, '../frontend/build')));.?如果沒有那些丟失的..express,則無法找到請求的靜態文件,并且它會回退到app.get('*', (req, res).?換句話說,index.html返回的是您的文件而不是任何靜態文件。



查看完整回答
反對 回復 2023-08-05
  • 1 回答
  • 0 關注
  • 113 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號