I have existing project that I tried installing package via npm install
.
I cloned my project again thinking that it would fix, but every time I run npm install
I am getting this error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/eslint
npm ERR! dev eslint@"^8.20.0" from the root project
npm ERR! peer eslint@">= 4.12.1" from [email protected]
npm ERR! node_modules/babel-eslint
npm ERR! dev babel-eslint@"^10.1.0" from the root project
npm ERR! 3 more (eslint-config-prettier, eslint-plugin-prettier, eslint-utils)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint@"^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0" from [email protected]
npm ERR! node_modules/eslint-plugin-import
npm ERR! dev eslint-plugin-import@"^2.23.4" from the root project
npm ERR! peer eslint-plugin-import@"^2.22.1" from [email protected]
npm ERR! node_modules/eslint-config-airbnb
npm ERR! 1 more (eslint-config-airbnb-base)
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/eslint
npm ERR! peer eslint@"^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0" from [email protected]
npm ERR! node_modules/eslint-plugin-import
npm ERR! dev eslint-plugin-import@"^2.23.4" from the root project
npm ERR! peer eslint-plugin-import@"^2.22.1" from [email protected]
npm ERR! node_modules/eslint-config-airbnb
npm ERR! 1 more (eslint-config-airbnb-base)
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.
I have no idea what is going on.
- what is the reason for this error?
- how can I get rid of it?
- is it the eslint that I have to remove to fix it?
CodePudding user response:
One possible cause for it is that you have some dependency, which has a peer dependency of specific version. Now, in your package.json you have another version of this peer dependency, so npm tells you this.
You have 2 options:
- Use in your package.json dependencies that are required by the problematic package
- Use --legacy-peer-deps flag or set this setting in
.npmrc
file to betrue
, which will ignore the peer dependency requirement and can possible break your code.
CodePudding user response:
this error can when you cannot install npm on the right folder this answer will help your sir...... otherwise your will try this npm install --legacy-peer-deps then it adds this in my package-lock.json
"node_modules/@unimodules/react-native-adapter": { "version": "5.7.0", "resolved": "https://registry.npmjs.org/@unimodules/react-native-adapter/-/react-native-adapter-5.7.0.tgz", "integrity": "sha512-L557/ sc8ZKJVgo1734HF1QNCxrt/fpqdmdNgySJT kErux/AJNfPq3flsK0fyJduVmniTutYIMyW48cFoPKDA==", "dependencies": { "invariant": "^2.2.4", "lodash": "^4.5.0" }, "peerDependencies": { "react-native": "*", "react-native-web": "~0.13.7" } },
...
"@unimodules/react-native-adapter": { "version": "5.7.0", "resolved": "https://registry.npmjs.org/@unimodules/react-native-adapter/-/react-native-adapter-5.7.0.tgz", "integrity": "sha512-L557/ sc8ZKJVgo1734HF1QNCxrt/fpqdmdNgySJT kErux/AJNfPq3flsK0fyJduVmniTutYIMyW48cFoPKDA==", "requires": { "invariant": "^2.2.4", "lodash": "^4.5.0" } },