How to fix Npm missing peer dependency

两盒软妹~` 提交于 2019-12-05 10:22:54

问题


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?


回答1:


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/


来源:https://stackoverflow.com/questions/41275301/how-to-fix-npm-missing-peer-dependency

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!