简体   繁体   中英

ENOENT error when serving React App on Azure

I have a React website hosted on Azure and successfully serving up pages without a problem.

However, I often get error messages in the Web App logs such as:

2021-03-01T15:01:33.957751902Z 15:01:33 0|static-page-server-8080  | [2021-03-01T15:01:33.956Z] 
Error while serving /home/site/wwwroot/build/profile with content-type text/plain : 
ENOENT: no such file or directory, open '/home/site/wwwroot/build/profile'

This error, for example, occurs when I navigate to: https://www.webaddress.com/account/profile

To be clear the pages are still served without a problem. So why am I receiving this error? And how can I stop it?

First, validate the distribution folder and check the file index.html, the labels have to be like this

 <base href="/">

and you "outputPath" have to be like this "dist",

          "outputPath": "dist",

Best regards

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