React project startup error Can't resolve 'fs' 'child_process' ... module similar error

Everything is difficult at the beginning, this sentence is really true!

I'm getting old, and now I have to learn react development, there is no way, for the sake of food and clothing, let's learn! Live and learn, this is also the truth!

After all, I know Vue, even if I develop React, it’s not that difficult. After reading the official documentation, I started developing the project that day, and I burst into tears!

Then I encountered a problem, and then I jumped into the pit and didn't know what was going on. Hey, let's unify the front end earlier, what are you doing with so many frameworks, I believe your evil!

Let’s talk about the pitfall I encountered. In the react project, because of a problem, I want to add a debugger statement to the js file of the component to debug it. Once the result is saved, the console is full of red errors, as follows:

At first, I thought it was a problem with webpack, or the node_moudule package, and then npm install, restart, and reinstall... After working for a long time, I didn't find any problems.

Finally, there is no way, the wool must have come from the sheep, carefully read the error message, starting from the known js file of the first error message , to see if there is anything unusual, and found out,

Your sister, I added a debugger in js, and webpack automatically introduced it in the header

import { debug } from 'webpack';

Then webpack can't debug itself, so it reports a series of errors, can't find the module or something, finds your sister, contradicts itself!

Solution : remove the code automatically introduced by webpack

Another experience I got is that if you encounter an error message, you still have to read it patiently. If you read more, you will know how to find the cause of the problem!

 

Guess you like

Origin blog.csdn.net/playboyanta123/article/details/115121883