找不到所需的文件.名称:index.html [英] Could not find a required file. Name: index.html

查看:634
本文介绍了找不到所需的文件.名称:index.html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have been working on this React project, since a few months without having come across this error. I haven't made any changes in the location of the index.html file in the project tree, which is why I can't explain this error.

我尝试了以下措施,但未成功:

I have tried the following measures without success:

  1. 更改公用文件夹的位置
  2. 更改公用文件夹内容的位置
  3. 更改package-lock.json的位置
  4. 更改package.json的位置
  5. npm安装
  6. npm install react-scripts --save

请找到显示在终端中的错误:

Please find the error displayed in the terminal:

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! frontend@0.1.0 start: `react-scripts start`  
npm ERR! Exit status 1  
npm ERR!   
npm ERR! Failed at the frontend@0.1.0 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文件? 如果没有,您可以使用Create React App使用

Does your project have an index.html file in the public directory? If not you can get the one that Create React App uses here

您是否使用git进行版本控制?我怀疑您已经移动了某些东西而没有意识到. Git能够告诉您是否发生了某些变化.

Are you using git for version control? I suspect that you have moved something without realising it. Git will be able to tell you if something did change.

这篇关于找不到所需的文件.名称:index.html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆