[Vue] Solve the error internal/modules/cjs/loader.js:968 throw err reported by npm run dev;

problem

Insert picture description here

solve

There are 2 methods, it is recommended to try the first one first, but not the second one

Reinstall the dependent environment

Delete the project node_modulesfolder and execute again

# 安装依赖环境
npm install

# 运行
npm run dev

Lower the version of webpack

Check package.jsonthe webpackrelevant version
Insert picture description here

# 卸载当前版本
npm uninstall webpack-dev-server
npm uninstall webpack

# 安装低版本
npm install [email protected] --save-dev
npm install [email protected] --save-dev

# 运行
npm run dev

If the execution npm uninstall webpack-dev-serveralso reports an error, you can only use the following method.
The reason is node_modulesthat the folder has been accidentally changed, resulting in incomplete dependent libraries.
solve:

  1. Delete under the projectnode_modules
  2. Re-execute in the project directory npm install, it will regeneratenode_modules
  3. carried outnpm run build
  4. carried outnpm run dev

Guess you like

Origin blog.csdn.net/weixin_43438052/article/details/114003558