[英]React app breaks with child compilation and webpack errors
I just finished the ReactJS.org tutorial and it was functional.我刚刚完成了 ReactJS.org 教程,它很实用。 Then I added a bunch of comments to explain each block of code, closed down the local server, and went home.
然后我加了一堆注释解释每个代码块,关闭本地服务器,回家。 When I re-opened it to start tweaking it and trying advanced options, it broke, with several errors (webpack, eslint, child compilation failed...).
当我重新打开它开始调整它并尝试高级选项时,它坏了,出现了几个错误(webpack、eslint、子编译失败......)。 The only thing that changed was a VS Code update.
唯一改变的是 VS Code 更新。
The main error seems to be related to webpack, but I don't have a webpack config file, and I'm not using it to my knowledge.主要错误似乎与 webpack 有关,但我没有 webpack 配置文件,据我所知,我没有使用它。 I used create-react-app to build the app, and deleted the files in the
src/
directory to start from scratch like the tutorial says to do.我使用create-react-app来构建应用程序,并删除了
src/
目录中的文件以从头开始,就像教程所说的那样。
Errors: (see image)错误:(见图)
npm start
, it says 1 ERROR in child compilations...
in the terminalnpm start
,它说1 ERROR in child compilations...
在终端 Troubleshooting:故障排除:
npm uninstall eslint
npm uninstall eslint
git checkout
of the previous commit (the finished tutorial) which was functional, but it's broken nowgit checkout
出,该提交是可用的,但现在已损坏npm ls
for reference (see images)npm ls
供参考(见图)I have reproduced this problem, but my problem is that I created a project based on create-react-app in the V16.* version of Node, but I ran it with the V12.* version of Node.我重现了这个问题,但是我的问题是我在V16.*版本的Node中创建了一个基于create-react-app的项目,但是我用V12.*版本的Node运行它。 So when I re-run the 16.* version it will work, hopefully that will help you
因此,当我重新运行 16.* 版本时,它会起作用,希望对您有所帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.