报错如下:
D:\xm\zhihuishequ\zhsq-web>npm run build
npm ERR! Missing script: "build"
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR! npm run
npm ERR! A complete log of this run can be found in:
npm ERR! D:\DevApp\nodejs\node_cache\_logs\2023-11-07T07_51_08_673Z-debug-0.log
D:\xm\zhihuishequ\zhsq-web>npm run build:prod
> ruoyi@3.7.0 build:prod
> vue-cli-service build
✔ Building for production...
ERROR Error: Cannot find module 'html-webpack-plugin'
Require stack:
- D:\xm\zhihuishequ\zhsq-web\node_modules\script-ext-html-webpack-plugin\lib\plugin.js
- D:\xm\zhihuishequ\zhsq-web\node_modules\script-ext-html-webpack-plugin\index.js
- D:\xm\zhihuishequ\zhsq-web\node_modules\webpack-chain\src\Plugin.js
- D:\xm\zhihuishequ\zhsq-web\node_modules\webpack-chain\src\Resolve.js
- D:\xm\zhihuishequ\zhsq-web\node_modules\webpack-chain\src\Config.js
- D:\xm\zhihuishequ\zhsq-web\node_modules\@vue\cli-service\lib\Service.js
- D:\xm\zhihuishequ\zhsq-web\node_modules\@vue\cli-service\bin\vue-cli-service.js
Error: Cannot find module 'html-webpack-plugin'
Require stack:
- D:\xm\zhihuishequ\zhsq-web\node_modules\script-ext-html-webpack-plugin\lib\plugin.js
- D:\xm\zhihuishequ\zhsq-web\node_modules\script-ext-html-webpack-plugin\index.js
- D:\xm\zhihuishequ\zhsq-web\node_modules\webpack-chain\src\Plugin.js
- D:\xm\zhihuishequ\zhsq-web\node_modules\webpack-chain\src\Resolve.js
- D:\xm\zhihuishequ\zhsq-web\node_modules\webpack-chain\src\Config.js
- D:\xm\zhihuishequ\zhsq-web\node_modules\@vue\cli-service\lib\Service.js
- D:\xm\zhihuishequ\zhsq-web\node_modules\@vue\cli-service\bin\vue-cli-service.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Object.<anonymous> (D:\xm\zhihuishequ\zhsq-web\node_modules\script-ext-html-webpack-plugin\lib\plugin.js:3:27)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Object.<anonymous> (D:\xm\zhihuishequ\zhsq-web\node_modules\script-ext-html-webpack-plugin\index.js:3:36)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
D:\xm\zhihuishequ\zhsq-web>npm install html-webpack-plugin -D
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: ruoyi@3.7.0
npm ERR! Found: webpack@4.46.0
npm ERR! node_modules/webpack
npm ERR! peer webpack@"^4.0.0" from @intervolga/optimize-cssnano-plugin@1.0.6
npm ERR! node_modules/@intervolga/optimize-cssnano-plugin
npm ERR! @intervolga/optimize-cssnano-plugin@"^1.0.5" from @vue/cli-service@4.4.6
npm ERR! node_modules/@vue/cli-service
npm ERR! peer @vue/cli-service@"^3.0.0 || ^4.0.0-0" from @vue/cli-plugin-babel@4.4.6
npm ERR! node_modules/@vue/cli-plugin-babel
npm ERR! dev @vue/cli-plugin-babel@"4.4.6" from the root project
npm ERR! 4 more (@vue/cli-plugin-eslint, @vue/cli-plugin-router, ...)
npm ERR! peer webpack@"^4.0.0 || ^5.0.0" from @soda/friendly-errors-webpack-plugin@1.8.1
npm ERR! node_modules/@soda/friendly-errors-webpack-plugin
npm ERR! @soda/friendly-errors-webpack-plugin@"^1.7.1" from @vue/cli-service@4.4.6
npm ERR! node_modules/@vue/cli-service
npm ERR! peer @vue/cli-service@"^3.0.0 || ^4.0.0-0" from @vue/cli-plugin-babel@4.4.6
npm ERR! node_modules/@vue/cli-plugin-babel
npm ERR! dev @vue/cli-plugin-babel@"4.4.6" from the root project
npm ERR! 4 more (@vue/cli-plugin-eslint, @vue/cli-plugin-router, ...)
npm ERR! 32 more (eslint-loader, @vue/cli-plugin-babel, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! dev html-webpack-plugin@"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: webpack@5.89.0
npm ERR! node_modules/webpack
npm ERR! peer webpack@"^5.20.0" from html-webpack-plugin@5.5.3
npm ERR! node_modules/html-webpack-plugin
npm ERR! dev html-webpack-plugin@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See D:\DevApp\nodejs\node_cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! D:\DevApp\nodejs\node_cache\_logs\2023-11-07T07_52_21_539Z-debug-0.log
解决:
重装一个 :npm i webpack-dev-server@3.10.3 -d