2021-06-30 vue 安装webpack包时遇到npm ERR的解决办法

54 篇文章 1 订阅
在尝试按照尚硅谷的建议安装Webpack及相关插件时遇到npm报错。错误涉及urix、resolve-url、uuid等已弃用的包。尽管如此,最终成功安装了所有包,并通过`npm audit fix`修复了7个安全漏洞。为确保安装成功,建议将npm降级到6.14.8版本,并运行`npm audit fix`以修复所有低级别和中等级别的安全问题。
摘要由CSDN通过智能技术生成

目录

尚硅谷的webpack的建议安装包

npm install -D webpack@4.41.5 webpack-cli@3.3.10 webpack-dev-server@3.10.2
npm install -D html-webpack-plugin clean-webpack-plugin  ts-loader cross-env

提示npm ERR!报错

PS F:前端2021-vue尚硅谷	ypescriptwebpack_ts> npm install -D webpack@4.41.5 webpack-cli@3.3.10 webpack-dev-server@3.10.2
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated querystring@0.2.0: The
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.

added 619 packages, and audited 621 packages in 53s

19 packages are looking for funding
  run `npm fund` for details

7 vulnerabilities (2 low, 5 moderate)

To address issues that do not require attention, run:
  npm audit fix

To address all issues, run:
  npm audit fix --force

Run `npm audit` for details.

推测是电脑的npm包太新了,将电脑npm降级即可完成安装

npm install -g npm@6.14.8

##最后用 npm audit fix来修复一下就能成功安装了

code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: compression-webpack-plugin@3.1.0 npm ERR! Found: webpack@3.12.0 npm ERR! node_modules/webpack 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.12.1 npm ERR! node_modules/@vue/cli-service npm ERR! dev @vue/cli-service@"^3.3.0" from the root project npm ERR! peer webpack@"2 || 3 || 4" from babel-loader@7.1.5 npm ERR! node_modules/babel-loader npm ERR! babel-loader@"^7.1.2" from vue-photo-preview@1.1.3 npm ERR! node_modules/vue-photo-preview npm ERR! vue-photo-preview@"^1.1.3" from the root project npm ERR! 11 more (eslint-loader, extract-text-webpack-plugin, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer webpack@"^4.3.0 || ^5.0.0" from compression-webpack-plugin@3.1.0 npm ERR! node_modules/compression-webpack-plugin npm ERR! dev compression-webpack-plugin@"^3.1.0" from the root project npm ERR! npm ERR! Conflicting peer dependency: webpack@5.86.0 npm ERR! node_modules/webpack npm ERR! peer webpack@"^4.3.0 || ^5.0.0" from compression-webpack-plugin@3.1.0 npm ERR! node_modules/compression-webpack-plugin npm ERR! dev compression-webpack-plugin@"^3.1.0" 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! npm ERR! For a full report see: npm ERR! C:\Users\zcybi\AppData\Local\npm-cache\_logs\2023-06-08T02_41_32_750Z-eresolve-report.txt
06-09
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值