npm run serve reported an error: Error: Cannot find module ‘webpack’ Require stack

created at 12-20-2021 views: 3

problem1

After the project is pulled down, the dependencies are installed normally, and the project is started.

Error: Cannot find module ‘webpack’ Require stack

Found that the webpack module is missing,

But I have already installed webpack, here I need to re-open cmd, install webpack globally

reason

Even if you installed webpack before, it must be a non-global installation

solution

npm install  -g webpack

After the installation is complete, the startup project found that an error was reported again! ! !

problem2

Error: Rule can only have one resource source (provided resource and test + include + exclude) in {
  "exclude": [
    null
  ]

reason

Webpack version conflict in package.json.

solution

Delete webpack and reinstall the previous version.

npm uninstall webpack
npm install webpack@^4.0.0 --save-dev
Please log in to leave a comment.