Webpack4 react error solution: 1. Enter the globally installed webpack directory; 2. Delete the installed webpack version; 3. Execute the command "npm un webpack npm un webpack-cli"; 4. Then Execute the "npm i webpack-dev-server@3.10.2" command.
The operating environment of this tutorial: Windows 10 system, react18.0.0 version, Dell G3 computer.
What should I do if webpack4 react reports an error?
The solution to the error after upgrading webpack4 locally in the react project
The error is reported as shown above:
Solution Method, enter the globally installed webpack directory:
Enter the directory: first delete the installed webpack version:
Execute the following commands in sequence:
npm un webpack npm un webpack-cli npm un webpack-dev-server npm i webpack@4.41.5 npm i webpack-cli npm i webpack-dev-server@3.1.14
Then run the project:
There is an error as follows:
The dev-server version we just installed is wrong, re-execute
npm i webpack-dev-server@3.10.2
Problem solved.
Recommended learning: "react video tutorial"
The above is the detailed content of What to do if webpack4 react reports errors. For more information, please follow other related articles on the PHP Chinese website!