简体   繁体   English

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

[英]ENOENT error when serving React App on Azure

I have a React website hosted on Azure and successfully serving up pages without a problem.我有一个托管在 Azure 上的 React 网站,并且成功地提供了页面而没有问题。

However, I often get error messages in the Web App logs such as:但是,我经常在 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'

This error, for example, occurs when I navigate to: https://www.webaddress.com/account/profile例如,当我导航到以下位置时会发生此错误: 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首先,验证分发文件夹并检查文件索引。html,标签必须是这样的

 <base href="/">

and you "outputPath" have to be like this "dist",而你的“outputPath”必须是这样的“dist”,

          "outputPath": "dist",

Best regards此致

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

相关问题 从子目录提供反应应用程序时出现脚本错误 - Script error while serving react app from a subdirectory create-react-app 使用代码 ENOENT 中止 - create-react-app aborting with code ENOENT 从 electron 应用程序运行 python 脚本时如何修复“错误:生成 py ENOENT”错误? - How to fix "Error: spawn py ENOENT" error when running python script from electron app? React Jest DynamoDb 测试抛出错误 ENOENT - React Jest DynamoDb Testing throws error ENOENT Angular(离子)应用程序构建在 Heroku 上 - 错误:ENOENT - Angular (Ionic) app build on Heroku - Error: ENOENT 在调用另一个可执行文件时,使用 pkg 打包节点应用程序会导致“ENOENT”错误,尽管文件存在 - Packaging Node App with pkg causes 'ENOENT' error, when calling another executable, despite file existing 使用 express(带头盔)使用 create-react-app 创建的应用程序时出现 CSP 错误 - CSP error while serving with express (with helmet) an app created with create-react-app 从Azure函数提供HTML文件时出错 - Error serving HTML files from an Azure function 我无法从终端运行带有npm的React JS应用程序,因为命令spawn失败并出现错误ENOENT - I cannot run my React JS app with npm from my terminal because the command spawn fails with error ENOENT 在 Electron 中提供静态文件(React 应用程序) - Serving static files in Electron (React app)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM