找不到所需的文件。名称:index.html

编程入门 行业动态 更新时间:2024-10-04 01:15:56

<a href=https://www.elefans.com/category/jswz/34/1771416.html style=找不到所需的文件。名称:index.html"/>

找不到所需的文件。名称:index.html

我一直在研究这个 React 项目,几个月以来一直没有遇到这个错误。我没有对项目树中 index.html 文件的位置进行任何更改,这就是我无法解释此错误的原因。

我试过以下措施都没有成功:

  1. 更改公用文件夹的位置
  2. 更改公用文件夹内容的位置
  3. 更改 package-lock.json 的位置
  4. 更改 package.json 的位置
  5. npm 安装
  6. npm 安装反应脚本——保存

请查找终端中显示的错误:

Could not find a required file.  
Name: index.html  
Searched in: /Users/Sujay/Documents/Documents/Learn Web Development the Hard Way/lacapsule/project/Dark Sky Map Bitbucket/darkskymap_frontend/public  
npm ERR! code ELIFECYCLE  
npm ERR! errno 1  
npm ERR! [email protected] start: `react-scripts start`  
npm ERR! Exit status 1  
npm ERR!   
npm ERR! Failed at the [email protected] start script.  
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/Sujay/.npm/_logs/2019-08-06T07_12_22_366Z-debug.log

Expected result : React project should launch without any issue.   
Actual result: Error message in terminal mentioned above.
回答如下:

index.html 已从 /public 目录中移动/删除

你的项目在public目录下有index.html文件吗?

如果没有,您可以在此处获得 Create React App 使用的那个

应该在

<your project root>/public/index.html


如果您使用 Git 进行版本控制,它将能够告诉您是否移动或删除了某些内容。

运行

git status
查看更改的文件

更多推荐

找不到所需的文件。名称:index.html

本文发布于:2024-05-31 00:54:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1771103.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:找不到   所需   名称   文件   html

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!