npm install 遇到的问题

648 阅读1分钟

出现以下错误 :。。。。。。。。。。。 npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: sass-loader@8.0.1 npm ERR! Found: webpack@4.28.4 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@3.9.2 npm ERR! node_modules/@vue/cli-service npm ERR! dev @vue/cli-service@"^3.9.0" from the root project npm ERR! peer webpack@"^2.0.0 || ^3.0.0 || ^4.0.0" from @soda/friendly-errors-webpack-plugin@1.7.1 npm ERR! node_modules/@soda/friendly-errors-webpack-plugin npm ERR! @soda/friendly-errors-webpack-plugin@"^1.7.1" from @vue/cli-service@3.9.2 npm ERR! node_modules/@vue/cli-service npm ERR! dev @vue/cli-service@"^3.9.0" from the root project npm ERR! 17 more (@vue/cli-plugin-babel, @vue/cli-plugin-eslint, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer webpack@"^4.36.0 || ^5.0.0" from sass-loader@8.0.1 npm ERR! node_modules/sass-loader npm ERR! dev sass-loader@"^8.0.1" from the root project npm ERR! npm ERR! Conflicting peer dependency: webpack@5.72.1 npm ERR! node_modules/webpack npm ERR! peer webpack@"^4.36.0 || ^5.0.0" from sass-loader@8.0.1 npm ERR! node_modules/sass-loader npm ERR! dev sass-loader@"^8.0.1" 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 C:\Users\v_yywwxing\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\v_yywwxing\AppData\Local\npm-cache_logs\2022-05-11T11_21_18_089Z-debug-0.log

解决方式:

在安装命令后加 --legacy-peer-deps

或者清理npm缓存后在安装(npm cache clean 清理缓存)