reactjs - 我安装 react-leaflet-search 时的问题
问题描述
当我尝试安装 react-leaflet-search 时遇到问题我遇到了这个错误
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: map-leaflet@0.1.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!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.12.0" from react-leaflet-search@2.0.1
npm ERR! node_modules/react-leaflet-search
npm ERR! react-leaflet-search@"*" 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\ramy\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\ramy\AppData\Local\npm-cache_logs\2021-09-25T09_01_07_075Z-debug.log
我不想改变我的反应版本!
解决方案
尝试npm install react-leaflet-search --legacy-peer-deps
在 NPM 7.0 之前,如果缺少对等依赖项,NPM 会通知您。从 NPM 7.0 开始,如果缺少对等依赖项,NPM 将尝试安装它,从而导致您的冲突。--legacy-peer-deps
flag 使 NPM 遵循 7.0 之前的约定。
推荐阅读
- visual-studio-code - 如何在 Visual Studio 代码资源管理器文件树结构中添加更多缩进?
- c# - 为什么没有 Light.color?
- python-3.x - 根据 2 个(理想情况下推广到 n 个)任意分组规则对字母字符串列表进行聚类?
- php - 我需要在服务器上运行我作为任务编写的 PHP 脚本
- android - 如何使用 style.xml 文件更改 MaterialCardView 的背景颜色?
- python - 链接方法时在 Jupyter Notebook 中自动完成
- javascript - 是否可以在javascript中使用字符代码而不是<和>?
- python - 在 numpy - 我如何通过将正弦波与正弦和余弦相关来计算正弦波的相位和幅度?
- javascript - 将数组中的用户注册信息与用户登录输入进行比较
- angular - 刷新后 fxLayout 出现问题