Categories
node.js npm reactjs webpack

Unable to resolve dependency tree with eslint-config-airbnb

when I’m trying to install eslint-config-airbnb with npx install-peerdeps --dev eslint-config-airbnb I’m getting following error (–legacy-peer-deps flag doesn’t help):

npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/eslint
npm ERR! dev [email protected]"7.2.0" from the root project
npm ERR! peer [email protected]"^5.16.0 || ^6.8.0 || ^7.2.0" from [email protected]
npm ERR! node_modules/eslint-config-airbnb
npm ERR! dev [email protected]"18.2.1" from the root project
npm ERR! 3 more (eslint-plugin-import, eslint-plugin-jsx-a11y, eslint-plugin-react)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer [email protected]"^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0" from [email protected]
npm ERR! node_modules/eslint-plugin-react-hooks
npm ERR! dev [email protected]"4.0.0" from the root project
npm ERR! peer [email protected]"^4 || ^3 || ^2.3.0 || ^1.7.0" from [email protected]
npm ERR! node_modules/eslint-config-airbnb
npm ERR! dev [email protected]"18.2.1" 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! ```

Run npm install --legacy-peer-deps and they will install successfully.

Looking at your package.json and comparing it to the peer dependencies listed for eslint-config-airbnb, you already have all the peer dependencies in your package.json as dev dependencies. (They were probably added there when you ran the npx install-peerdeps command but then that command tried to run npm install and failed.)