1. HTTP3W博客首页
  2. 技术
  3. vue

npm ERR! code ERESOLVE

vue安装命令, npm install时报错:


D:\workspace\IM\websocket-master>npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: react-demo@1.0.0
npm ERR! Found: webpack@3.12.0
npm ERR! node_modules/webpack
npm ERR! dev webpack@"^3.6.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^2.2.0" from extract-text-webpack-plugin@2.1.2
npm ERR! node_modules/extract-text-webpack-plugin
npm ERR! dev extract-text-webpack-plugin@"^2.1.2" 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:\tools\node-v10.7.0-win-x64\node_cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR! D:\tools\node-v10.7.0-win-x64\node_cache\_logs\2022-06-29T01_21_50_418Z-debug-0.log

输入npm -V发现我的npm版本为7.x的,因为npm7.x版本对某些命令比npm6.x更严格,所以莫名报了这个错

解决办法有两种:
1.在命令后加上–legacy-peer-deps
2.使用npm6.x

提示:使用npm@6不需要卸载npm@7。可以使用npx指定npm的版本。例如:npx -p npm@6 npm i –legacy-peer-deps

如果这不能立即起作用,可以先删除 node_modules和 package-lock.json
npm install -D sass-loader node-sass --legacy-peer-deps

安装成功

1、原创文章,作者:诺米,如若转载,请注明出处:https://www.http3w.com/archives/761

2、本站内容若有雷同从属巧合,若侵犯了您的权益,请联系本站删除,E-mail: wtao219@qq.com

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

联系我们

254007489

在线咨询:点击这里给我发消息

邮件:wtao219@qq.com

工作时间:周一至周五,9:30-18:30,节假日休息