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 ├─┬ [email protected] ├─┬ [email protected] ├─┬ [email protected] │ └── [email protected] ├─┬ [email protected] ├─┬ [email protected] │ ├─┬ [email protected] │ ├─┬ [email protected] ├─┬ UNMET PEER DEPENDENCY [email protected] ├─┬ [email protected] npm ERR! peer dep missing: eslint-plugin-jsx-a11y@^2.2.3, required by [email protected]
As you see, I have installed [email protected]
which is definitely fulfill ^2.2.3
required by
eslint-config-airbnb
. However, it shows such error message. Any idea for solving such problem?
A command-line interface to install an NPM package and its peer dependencies automatically. Starting with NPM v3. 0, peer dependencies are not automatically installed on npm install , and it can be a hassle to install them all manually.
Solution 1: Ignore the peerDependencies The easiest way to fix the issue is to pass an additional parameter –legacy-peer-deps to npm install. The --legacy-peer-deps tells the npm to ignore the peer dependencies and continue the installation of the package.
Peer Dependencies are used to specify that our package is compatible with a specific version of an npm package. Good examples are Angular and React. To add a Peer Dependency you actually need to manually modify your package.json file.
To add dependencies and devDependencies to a package. json file from the command line, you can install them in the root directory of your package using the --save-prod flag for dependencies (the default behavior of npm install ) or the --save-dev flag for devDependencies.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With