问题

在执行 npm install 时看到以下错误:

could not resolve dependency: npm err! peer react@"^16.8.0 || ^17.0.0" from @material-ui/core@4.12.4

环境

"dependencies": {"@material-ui/core": "^4.12.4","@material-ui/icons": "^4.11.3","@testing-library/jest-dom": "^5.16.5","@testing-library/react": "^13.3.0","@testing-library/user-event": "^13.5.0","fontsource-roboto": "^4.0.0","i18next": "^21.9.1","i18next-browser-languagedetector": "^6.1.5","react": "^18.2.0","react-dom": "^18.2.0","react-i18next": "^11.18.4","react-scripts": "5.0.1","web-vitals": "^2.1.4"},

说明

系统使用了 Material UI (MUI) 和 ReactJS 18,很明显 MUI 的最新版本没有支持 ReactJS 18。

解决方案

使用以下命令,让 NPM 支持更高的 ReactJS 版本

npm config set legacy-peer-deps true

总结

本文介绍了如何解决因为 Material UI 这样的 NPM 包不支持更高版本的依赖项 ReactJS 的解决方案。

参考链接

  • https://stackoverflow.com/questions/72596908/could-not-resolve-dependency-error-peer-react16-8-0-17-0-0-from-materia

could not resolve dependency: npm err! peer react@“^16.8.0 || ^17.0.0“ from @material-ui/core@4.12.4相关推荐

  1. npm报错 npm ERR! Could not resolve dependency:npm ERR! peer pug@“^2.0.0“ from pug-loader@2.4.0

    npm报错 npm ERR! Could not resolve dependency:npm ERR! peer pug@"^2.0.0" from pug-loader@2.4 ...

  2. vue3安装vuex报错: Could not resolve dependency npm ERR peer vue@“^2.0.0“ from vuex@3.6.2

    解决方法: 输入npm install vuex@next --save,就可以安装成功

  3. npm安装报错:npm ERR! Verification failed while extracting mocha-el-ui@2.1.0

    报错信息:大概意思就是认证信息失败 解决方案:删除安装的node-modules 和 package-lock.json 两个文件 再重新安装 npm install,就行了

  4. NPM包发布过程中报错——`npm ERR! Unexpected token < in JSON at position 0 while parsing near ‘<!DOCTYPE HTML P

    1.异常报错过程:发包过程中,进行 npm login 时出现以下报错 2.报错原因:npm 的镜像源异常,且代理未进行设置 3.解决 npm config get proxy npm config ...

  5. 当在 终端 中用 npm 安装 Vant 组件库时,发生“npm ERR code ERESOLVE ;npm ERRERESOLVE could not resolve;”报错时,该怎么办?

    出现的问题: 当在 终端 中用 npm 安装 Vant 组件库时,发生 npm ERR! code ERESOLVE: npm ERR! ERESOLVE could not resolve:报错时, ...

  6. npm 报错: npm ERR! code ERESOLVE , npm ERR! code E404

    npm 报错: PS D:\Software\HBuilderX\Workspace\vant\vant-demo\vant\vue2> npm install npm ERR! code ER ...

  7. 【npm i 报错解决方法】npm ERR! code ERESOLVEnpm ERR!npm ERR! While resolving: by-web@1.2.2npm ERR!

    [npm i 报错解决方法]npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! np ...

  8. npm ERR! code ERESOLVEnpm ERR! ERESOLVE could not resolvenpm ERR! npm ERR! While resolving: @vue/

    Vue开发中使用npm安装插件出现的报错: npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR!  npm ERR! ...

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

    问题 npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! Foun ...

最新文章

  1. Spring注解Annotation
  2. 20145221 《信息安全系统设计基础》第3周学习总结
  3. 浏览器中遮罩层镂空效果的多种实现方法
  4. 通俗易懂:贪心算法(一):分配问题 (力扣455分发饼干 和135分发糖果)
  5. springboot2 cookie的token如何放入请求头_Spring MVC 到底是如何工作的
  6. HiveSQL常用优化方法全面总结
  7. mysql导出选择两张表,Mysql导出(多张表)表结构及表数据 mysqldump用法
  8. 如何做好一位合格qc_如何管理好生产质量?
  9. 实验楼python挑战答案_楼赛第1期-Linux项目挑战 题目解析
  10. elastaticresearch 学习过程
  11. 全网首发:doubango提示text relocations错误的解决办法
  12. mysql 附近3公里的,mysql 查询附近N公里内数据
  13. amos调节变量怎么画_结构方程模型建模思路及Amos操作--调节变量效果确定(二)...
  14. 程序员的“三十而已”
  15. 解决服务器挖矿漏洞 crypto
  16. 微信小程序使用高德SDK获取天气
  17. 利用C#编写一个高斯正反算程序
  18. word中目录出现省略号疏密不一致
  19. Linux_centos版初学(基础命令)
  20. 文笔极佳的郭靖夫妇悼文

热门文章

  1. 进一步认识Deepchem的分子特征化: 将化学分子结构作为到随机森林\CNN\RNN\GNN等机器学习模型输入的三种方法
  2. IntelliJ IDEA运行JAVA
  3. 矩阵连乘 动态规划_如何构建移动营销时代的“动态矩阵”?
  4. 修改bash中PS1命令提示符的颜色
  5. Tableau参数:自定义周起始时间
  6. 【FAQ】Gerrit上打开的单子无法打开,点击提示“MissingobjectException:Missing unknown xxxx”
  7. Spring boot 2.0 mongoTemplate 操作范例
  8. NAT 技术最全详解 : 换个马甲就能上网
  9. cisp含金量怎么样?
  10. swiper.js横向轮播插件