这是我得到的错误
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @mui/styles@5.11.9
npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR! react@"^18.2.0" from the root project
npm ERR! peer react@">=16.8.0" from @emotion/react@11.10.4
npm ERR! node_modules/@emotion/react
npm ERR! @emotion/react@"^11.10.4" from the root project
npm ERR! peer @emotion/react@"^11.0.0-rc.0" from @emotion/styled@11.10.4
npm ERR! node_modules/@emotion/styled
npm ERR! @emotion/styled@"^11.10.4" from the root project
npm ERR! 4 more (@mui/material, @mui/styled-engine, @mui/system, @mui/x-date-pickers)
npm ERR! 4 more (@mui/material, @mui/styled-engine, @mui/system, @mui/x-date-pickers)
npm ERR! 20 more (@emotion/styled, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^17.0.0" from @mui/styles@5.11.9
npm ERR! node_modules/@mui/styles
npm ERR! @mui/styles@"^5.11.7" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react@17.0.2
npm ERR! node_modules/react
npm ERR! peer react@"^17.0.0" from @mui/styles@5.11.9
npm ERR! node_modules/@mui/styles
npm ERR! @mui/styles@"^5.11.7" 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 /home/varun/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/varun/.npm/_logs/2023-02-23T08_28_03_194Z-debug-0.log
我试着升级我正在使用的npm包的版本,但是仍然有冲突。我需要它们没有错误,因为它很快就要投入生产了。我不想总是使用npm install --force
1条答案
按热度按时间dfuffjeb1#
从npm版本7开始,
npm install
在遇到冲突的对等依赖项时将失败。Read more about this behaviour here
您可以通过使用
--force
或--legacy-peer-deps
来克服这个问题。--force
为冲突设置不同的对等依赖项版本--legacy-peer-deps
忽略对等依赖项或