npm 错误 —— npm ERR! code ERESOLVE 解决方法

使用 npm install 命令安装依赖报错:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: project@0.0.0
npm ERR! Found: stylelint@15.11.0
npm ERR! node_modules/stylelint
npm ERR!   dev stylelint@"^15.4.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer stylelint@">= 11.x < 15" from stylelint-config-prettier@9.0.5
npm ERR! node_modules/stylelint-config-prettier
npm ERR!   dev stylelint-config-prettier@"^9.0.5" 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\lenovo\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\lenovo\AppData\Local\npm-cache\_logs\2024-01-30T03_31_51_815Z-debug.log

解决方法

在命令后面加上

--legacy-peer-deps

如下:

 npm install --legacy-peer-deps

你可能感兴趣的:(异常/错误记录,npm,前端,node.js)