您现在的位置是:首页 > 伤感句子

【npm】npm install命令报错npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree

作者:璐璐时间:2024-04-08 19:15:29分类:伤感句子

简介  文章浏览阅读5.4k次,点赞2次,收藏7次。npm install命令报错npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree_npm err! code eres

点击全文阅读

文章目录

一、现象:二、原因三、解决方案


一、现象:

npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree

npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency treenpm ERR! code ERESOLVEnpm ERR! ERESOLVE unable to resolve dependency treenpm ERR! npm ERR! Found: webpack@5.11.1npm ERR! node_modules/webpacknpm ERR!   dev webpack@"4.41.5" from the root projectnpm ERR!   peer webpack@">=2" from babel-loader@8.2.2npm ERR!   node_modules/babel-loadernpm ERR!     dev babel-loader@"^8.0.0" from the root projectnpm ERR!   2 more (copy-webpack-plugin, css-loader)npm ERR! npm ERR! Could not resolve dependency:npm ERR! dev mini-css-extract-plugin@"^0.9.0" from the root projectnpm ERR! npm ERR! Conflicting peer dependency: webpack@4.44.2npm ERR! node_modules/webpacknpm ERR!   peer webpack@"^4.4.0" from mini-css-extract-plugin@0.9.0npm ERR!   node_modules/mini-css-extract-pluginnpm ERR! npm ERR! Fix the upstream dependency conflict, or retrynpm ERR! this command with --force, or --legacy-peer-depsnpm ERR! to accept an incorrect (and potentially broken) dependency resolution.
二、原因

ERESOLVE与npm@7有关的问题很常见,因为npm7.x对某些事情比npm6.x更严格。通常,最简单的解决方法是将–legacy-peer-deps标志传递给npm(e.g.,npm i --legacy-peer-deps),或者使用npm@6。

如果这不能立即起作用,也许可以先删除node_modules和package-lock.json。它们将被重新创建。

三、解决方案

降级npm到6版本

使用npx指定npm的版本 npx -p npm@6 npm i --legacy-peer-deps

点击全文阅读

郑重声明:

本站所有活动均为互联网所得,如有侵权请联系本站删除处理

我来说两句