cause
There are various reasons for this error. Although it is the same error, the possible cause is completely different. Therefore, rational analysis is still required.
The reason I encountered was that I planned to add the less function to the vue3 project (almost a new project). So I executed the following code to install less
npm install less less-loader --save
After the installation is complete, I plan to use it, but I forgot how to configure less in webpack.
without configuration. I ran the project directly with npm run serve, and this error occurred.
I thought to myself, forget it, I don’t need less for now, so I executed the following command to uninstall less.
npm uninstall less less-loader
After uninstalling, run npm run serve to run the project, but found that this error is still reported.
Cause analysis and solution ideas
So I searched for this error directly on Baidu. There are many reasons for this error.
So I did a crucial step:
read the error carefully.
Read the error carefully.
Read the error carefully.
The direct cause of this error is this vue-loader-v16. This is critical and helps us reduce the margin for error. This may not be your error, but something must be wrong.
at VueLoaderPlugin.apply (路径\node_modules\vue-loader-v16\dist\pluginWebpack5
At this time, it is much better to use a search engine to search for the specific error below than to directly search for the title. Pay attention to remove irrelevant path information.
node_modules\vue-loader-v16\dist\pluginWebpack5
The first article I opened solved the problem for me.
The error encountered by this person is the same as mine, and they all report vue-loader-v16 errors. The reason he encountered was that the computer was replaced.
The solution he gave was to reinstall webpack.
npm install [email protected] --save
I was skeptical about this solution at first, but decided to give it a try. The results really work. If it is invalid, you can try to change to another webpack version.
It is best to check the original webpack version and install it again.
[email protected]
Summarize
Guessing from the phenomenon, it may be caused by the incompatibility between the version of the plug-in you installed and the local webpack.