问题
项目之前打包好好的,今天拉取仓库代码下来后重新打包,发现报错了,控制条打印ERROR Error: Cannot find module ‘html-webpack-plugin’
解决方案
找不到html-webpack-plugin这个依赖插件,我们就安装这个依赖插件,然后再重新打包,咦,这样就解决了,打包成功;
- 1、安装
npm install html-webpack-plugin -D
- 2、重新打包就可以了
> mengzhu-operation@4.7.0 build:prod E:\MengZhuKeJiWork\projects\mengzhu-operation
> vue-cli-service build
✔ Building for production...
ERROR Error: Cannot find module 'html-webpack-plugin'
Require stack:
- E:\MengZhuKeJiWork\projects\mengzhu-operation\node_modules\script-ext-html-webpack-plugin\lib\plugin.js
- E:\MengZhuKeJiWork\projects\mengzhu-operation\node_modules\script-ext-html-webpack-plugin\index.js
- E:\MengZhuKeJiWork\projects\mengzhu-operation\node_modules\webpack-chain\src\Plugin.js
- E:\MengZhuKeJiWork\projects\mengzhu-operation\node_modules\webpack-chain\src\Resolve.js
- E:\MengZhuKeJiWork\projects\mengzhu-operation\node_modules\webpack-chain\src\Config.js
- E:\MengZhuKeJiWork\projects\mengzhu-operation\node_modules\@vue\cli-service\lib\Service.js
- E:\MengZhuKeJiWork\projects\mengzhu-operation\node_modules\@vue\cli-service\bin\vue-cli-service.js
Error: Cannot find module 'html-webpack-plugin'
Require stack:
- E:\MengZhuKeJiWork\projects\mengzhu-operation\node_modules\script-ext-html-webpack-plugin\lib\plugin.js
- E:\MengZhuKeJiWork\projects\mengzhu-operation\node_modules\script-ext-html-webpack-plugin\index.js
- E:\MengZhuKeJiWork\projects\mengzhu-operation\node_modules\webpack-chain\src\Plugin.js
- E:\MengZhuKeJiWork\projects\mengzhu-operation\node_modules\webpack-chain\src\Resolve.js
- E:\MengZhuKeJiWork\projects\mengzhu-operation\node_modules\webpack-chain\src\Config.js
- E:\MengZhuKeJiWork\projects\mengzhu-operation\node_modules\@vue\cli-service\lib\Service.js
- E:\MengZhuKeJiWork\projects\mengzhu-operation\node_modules\@vue\cli-service\bin\vue-cli-service.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:931:15)
at Function.Module._load (internal/modules/cjs/loader.js:774:27)
at Module.require (internal/modules/cjs/loader.js:1003:19)
at require (internal/modules/cjs/helpers.js:107:18)
at Object.<anonymous> (E:\MengZhuKeJiWork\projects\mengzhu-operation\node_modules\script-ext-html-webpack-plugin\lib\plugin.js:3:27)
at Module._compile (internal/modules/cjs/loader.js:1114:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
at Module.load (internal/modules/cjs/loader.js:979:32)
at Function.Module._load (internal/modules/cjs/loader.js:819:12)
at Module.require (internal/modules/cjs/loader.js:1003:19)
at require (internal/modules/cjs/helpers.js:107:18)
at Object.<anonymous> (E:\MengZhuKeJiWork\projects\mengzhu-operation\node_modules\script-ext-html-webpack-plugin\index.js:3:36)
at Module._compile (internal/modules/cjs/loader.js:1114:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
at Module.load (internal/modules/cjs/loader.js:979:32)
at Function.Module._load (internal/modules/cjs/loader.js:819:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mengzhu-operation@4.7.0 build:prod: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mengzhu-operation@4.7.0 build:prod script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! D:\appInstall\nodejs-v14\node_cache\_logs\2023-12-16T06_41_58_046Z-debug.log