I'm building React UI library and I bumped into a problem resolving dependencies between my packages. My current package depends on my other packages and now I'm trying to install all dependencies into my working @kelysty/npm-template:
I RUN: npm i
ERROR (working bash terminal)
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: @kelysty/[email protected]
npm ERR! Found: eslint@undefined
npm ERR! node_modules/eslint
npm ERR! dev eslint@"^8.54.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint@"^8.0.0" from @kelysty/[email protected]
npm ERR! node_modules/@kelysty/eslint-config
npm ERR! dev @kelysty/eslint-config@"^1.0.0" 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.
Dependencies of package.json file of WORKING pkg (partial)
"devDependencies": {
...
"@kelysty/eslint-config": "^1.0.1",
"eslint": "^8.54.0",
...
},
"peerDependencies": {
...
},
Dependencies of package.json file of pkg that I INSTALL (partial)
"devDependencies": {
...
"eslint": "^8.54.0",
},
"peerDependencies": {
"eslint": "^8.0.0",
"prettier": "^3.0.0"
},
EXPECTED BEHAVIOR
Just install packages. I cannot see how this error occurs: peerDeps of eslint-config requires eslint of ^8.0.0 to be installed, while devDeps of my working dir are installing ^8.54.0. How this is an error?! Hod does pkg resolving works then?!
I'VE TRIED
None of these helped:
- --legacy-peer-deps
- --force
- npm update
- npm ci
- removing package-lock.json and node_modules
- reading about deps resolving (didn't find good article, so here we are)
PS
I can provide whole lists of dependencies of both projects if you think it's gonna help. Just didn't want to litter ticket