简体   繁体   English

找不到模块:无法解析“C:\Users\user\Desktop\react-challenge\sample\src”中的“./App”

[英]Module not found : Can't resolve './App' in 'C:\Users\user\Desktop\react-challenge\sample\src'

I am learning react from a playlist and had created a basic app with create-react-app it was up and running without any issues initially.我正在从播放列表中学习反应,并使用 create-react-app 创建了一个基本应用程序,它最初启动并运行没有任何问题。 After I deleted some files in ' src ' and ' public ' ,the terminal is showing this error:删除' src '' public '中的一些文件后,终端显示此错误:

./src/index.js
Module not found: Can't resolve './App' in 'C:\Users\user\Desktop\react-challenge\sample\src'

I deleted everything except for 'index.html' in public and 'index.js' in src file.我删除了公共文件中的“index.html”和 src 文件中的“index.js”以外的所有内容。 I have attached the folder structure and index.js below.我在下面附上了文件夹结构和 index.js。

这是我当前的文件夹结构

这是我的 index.js 代码

EDIT: it was an issue regarding the files getting saved and reloading it is solved now.编辑:这是一个关于文件被保存和重新加载的问题,现在已经解决了。

It's fine to delete App.js if you're not using it, and it looks like you're not.如果你不使用它,删除 App.js 很好,看起来你没有。 You probably just need to restart your development server.您可能只需要重新启动开发服务器。

Stop it with Ctrl + CCtrl + C停止它
Start it again with npm start or yarn startnpm startyarn start再次启动

power off your code editor and start again the code editor then run npm start in the terminal关闭代码编辑器并重新启动代码编辑器,然后在终端中运行 npm start

暂无
暂无

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

相关问题 找不到模块:无法解析“C:\\Users\\USER\\Desktop\\test\\src”中的“react” - Module not found: Can't resolve 'react' in 'C:\Users\USER\Desktop\test\src' 未找到模块:无法解析“C:\Users\USER\auth_form_react\src”中的“firebaseui” - Module not found: Can't resolve 'firebaseui' in 'C:\Users\USER\auth_form_react\src' 找不到模块:无法解析“C:\Users\MSI\Desktop\cake-app\src\Components\Product”中的“../../images/jelly” - Module not found: Can't resolve '../../images/jelly' in 'C:\Users\MSI\Desktop\cake-app\src\Components\Product' 找不到模块:无法解析“C:\\Users\\Admin\\Desktop\\MyApp\\frontend\\src\\components”中的“axios” - Module not found: Can't resolve 'axios' in 'C:\Users\Admin\Desktop\MyApp\frontend\src\components' 找不到模块:错误:无法解析“/home/user/Desktop/my_app/src”中的“./app” - Module not found: Error: Can't resolve './app' in '/home/user/Desktop/my_app/src' ./src/Firebase.js 模块未找到:无法解析“C:\\Users\\HP\\Desktop\\React\\clone\\disney-plus-clone\\src”中的“firebase” - ./src/Firebase.js Module not found: Can't resolve 'firebase' in 'C:\Users\HP\Desktop\React\clones\disney-plus-clone\src' ./src/App.js 模块未找到:无法解析“/Users/temp/Desktop/myfirstreact/src”中的“./Features/Assignment/assignment” - ./src/App.js Module not found: Can't resolve './Features/Assignment/assignment' in '/Users/temp/Desktop/myfirstreact/src' 未找到模块:无法解析“C:\Users\Mohammad\Desktop\Chat-System\src\components”中的“..src/firebase.js” - Module not found: Can't resolve '..src/firebase.js' in 'C:\Users\Mohammad\Desktop\Chat-System\src\components' [React Webpack]:找不到模块:错误:无法解析 'C:\Users\...' 中的 'src/views/UserList' - [React Webpack]: Module not found: Error: Can't resolve 'src/views/UserList' in 'C:\Users\…' ./src/index.js 找不到模块:无法解析“c:\users\.....”中的“react-dom/client” - ./src/index.js Module not found: Can't resolve 'react-dom/client' in "c:\users\....."
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM