当前位置:编程学习 > JS >>

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

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @wordpress/scripts@26.19.0
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   react@"^17.0.2" from the root project
npm ERR!   peer react@">=16.8.0" from @emotion/react@11.8.1
npm ERR!   node_modules/@emotion/react
npm ERR!     @emotion/react@"^11.1.1" from react-select@5.2.2
npm ERR!     node_modules/react-select
npm ERR!       react-select@"^5.2.2" from the root project
npm ERR!       1 more (@types/react-select)
npm ERR!   21 more (@icons/material, @loadable/component, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^18.0.0" from @wordpress/scripts@26.19.0
npm ERR! node_modules/@wordpress/scripts
npm ERR!   dev @wordpress/scripts@"^26.19.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: react@18.2.0
npm ERR! node_modules/react
npm ERR!   peer react@"^18.0.0" from @wordpress/scripts@26.19.0
npm ERR!   node_modules/@wordpress/scripts
npm ERR!     dev @wordpress/scripts@"^26.19.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! /yizuotu.com/.npm/_logs/2024-03-24T10_34_00_739Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: /yizuotu.com/.npm/_logs/2023-12-24T10_34_00_739Z-debug-0.log


通常是依赖包被判别为冲突(实际上不一定冲突)时抛出的错误,如确定不存在冲突时,可用以下方法:

在需要运行的命令后加上:--legacy-peer-deps 

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,