简体   繁体   English

更新 package.json 中的库

[英]Update the library in package.json

I want to update the libraries in package.json in a batch, so I executed the command ② after executing the command ①.我想批量更新package.json中的库,所以在执行命令①后执行命令②。
After that, I executed the yarn command and the libraries were installed, but when I executed npm install after executing the commands (1) and (2), I got an error.之后,我执行了yarn命令并安装了库,但是在执行命令(1)和(2)后执行npm install时,出现错误。
Why does npm install give me an error?为什么 npm install 给我一个错误?

①rm -rf node_modules yarn.lock
② npx npm-check-updates -u

error错误

npm ERR!   react@"18.2.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0 || ^17.0.0" from @material-ui/core@4.12.4
npm ERR! node_modules/@material-ui/core
npm ERR!   @material-ui/core@"^4.12.4" 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 /user/.npm/eresolve-report.txt for a full report.

you have a dependency conflict in your packages.你的包中有依赖冲突。 @material-ui/core@4.12.4 needs react 16/17 but you are using react 18 @material-ui/core@4.12.4 需要 react 16/17 但你正在使用 react 18

upgrade to material-ui v5升级到 material-ui v5

OR或者

use --force flag knowing that there may be some breaking changes使用 --force 标志知道可能会有一些重大变化

npm install --force

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM