如何修复 Npm 缺少对等依赖项 [英] How to fix Npm missing peer dependency
本文介绍了如何修复 Npm 缺少对等依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不知道如何修复以下对等依赖错误.
mondwan@mondwan-All-Series:~/Documents/git/py-cli_build_tools$ sudo npm -g list |grep eslint├─┬ babel-eslint@7.1.1├─┬ eslint@3.12.2├─┬ eslint-config-airbnb@13.0.0│ └── eslint-config-airbnb-base@10.0.1├─┬ eslint-config-eslint@3.0.0├─┬ eslint-plugin-import@2.2.0│ ├─┬ eslint-import-resolver-node@0.2.3│ ├─┬ eslint-module-utils@2.0.0├─┬ UNMET PEER DEPENDENCY eslint-plugin-jsx-a11y@3.0.2├─┬ eslint-plugin-react@6.8.0npm 错误!缺少 peer dep:eslint-plugin-jsx-a11y@^2.2.3,eslint-config-airbnb@13.0.0 需要
如你所见,我已经安装了eslint-plugin-jsx-a11y@3.0.2
,这绝对满足
^2.2.3
eslint-config-airbnb
.但是,它显示了这样的错误消息.有解决此类问题的想法吗?
解决方案
我对^2.2.3
版本中^
的含义理解有误.>
阅读此链接后,^2.2.3
表示 >=2.2.3 <3.X
.这就是 npm 抛出警告的原因.
此外,下面是关于peer-dependencies
- npm 包中的依赖项、devDependencies 和 peerDependencies 之间有什么区别.json 文件?
- https://nodejs.org/en/blog/npm/peer-dependencies/
I do not know how to fix below peer dependency error.
mondwan@mondwan-All-Series:~/Documents/git/py-cli_build_tools$ sudo npm -g list | grep eslint
├─┬ babel-eslint@7.1.1
├─┬ eslint@3.12.2
├─┬ eslint-config-airbnb@13.0.0
│ └── eslint-config-airbnb-base@10.0.1
├─┬ eslint-config-eslint@3.0.0
├─┬ eslint-plugin-import@2.2.0
│ ├─┬ eslint-import-resolver-node@0.2.3
│ ├─┬ eslint-module-utils@2.0.0
├─┬ UNMET PEER DEPENDENCY eslint-plugin-jsx-a11y@3.0.2
├─┬ eslint-plugin-react@6.8.0
npm ERR! peer dep missing: eslint-plugin-jsx-a11y@^2.2.3, required by eslint-config-airbnb@13.0.0
As you see, I have installed eslint-plugin-jsx-a11y@3.0.2
which is definitely fulfill ^2.2.3
required by
eslint-config-airbnb
. However, it shows such error message. Any idea for solving such problem?
解决方案
I have mis-understood the meaning of the ^
in version ^2.2.3
.
After reading this link, ^2.2.3
means >=2.2.3 <3.X
. That's why npm throws an warning.
Besides, below are links about peer-dependencies
- What's the difference between dependencies, devDependencies and peerDependencies in npm package.json file?
- https://nodejs.org/en/blog/npm/peer-dependencies/
这篇关于如何修复 Npm 缺少对等依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文