繁体   English   中英

在 Azure 上提供 React App 时出现 ENOENT 错误

[英]ENOENT error when serving React App on Azure

我有一个托管在 Azure 上的 React 网站,并且成功地提供了页面而没有问题。

但是,我经常在 Web App 日志中收到错误消息,例如:

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'

例如,当我导航到以下位置时会发生此错误: https://www.webaddress.com/account/profile

需要明确的是,仍然可以毫无问题地提供页面。 那么为什么我会收到此错误? 我该如何阻止它?

首先,验证分发文件夹并检查文件索引。html,标签必须是这样的

 <base href="/">

而你的“outputPath”必须是这样的“dist”,

          "outputPath": "dist",

此致

暂无
暂无

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

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