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: eslint-plugin-import#2.24.1
npm ERR! Found: eslint#8.20.0
npm ERR! node_modules/eslint
npm ERR! dev eslint#"^8.20.0" from the root project
npm ERR! peer eslint#">= 4.12.1" from babel-eslint#10.1.0
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 eslint-plugin-import#2.24.1
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 eslint-config-airbnb#18.2.1
npm ERR! node_modules/eslint-config-airbnb
npm ERR! 1 more (eslint-config-airbnb-base)
npm ERR!
npm ERR! Conflicting peer dependency: eslint#7.32.0
npm ERR! node_modules/eslint
npm ERR! peer eslint#"^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0" from eslint-plugin-import#2.24.1
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 eslint-config-airbnb#18.2.1
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?
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 be true, which will ignore the peer dependency requirement and can possible break your code.
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"
}
},
Related
I know this is related to React / React-DOM package dependency conflict, but the solutions which I can find there don't really help me.
When installing/updating a dependency or when deploying my Next.js app to Vercel, I get some of the following errors:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: use-ackee#3.0.1
npm ERR! Found: react#18.2.0
npm ERR! node_modules/react
npm ERR! react#"^18.2.0" from the root project
npm ERR! peer react#"^18.0.0" from #testing-library/react#13.4.0
npm ERR! node_modules/#testing-library/react
npm ERR! #testing-library/react#"^13.4.0" from the root project
npm ERR! 5 more (next, react-dom, react-helmet, react-side-effect, styled-jsx)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^17.0.0" from use-ackee#3.0.1
npm ERR! node_modules/use-ackee
npm ERR! use-ackee#"^3.0.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react#17.0.2
npm ERR! node_modules/react
npm ERR! peer react#"^17.0.0" from use-ackee#3.0.1
npm ERR! node_modules/use-ackee
npm ERR! use-ackee#"^3.0.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!
My package.json looks like this:
"dependencies": {
"#testing-library/jest-dom": "^5.16.5",
"#testing-library/react": "^13.4.0",
"#testing-library/user-event": "^13.5.0",
"next": "^13.1.6",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-helmet": "^6.1.0",
"sass": "^1.58.0",
"use-ackee": "^3.0.1",
"web-vitals": "^2.1.4"
},
I'm fully aware that I can just use --force or --legacy-peer-deps and everything works fine, but this seems like it is not really stable.
What is the exact problem I'm dealing with here? What can I do to resolve those conflicts?
I installed react#experimental which got version 0.0.0-experimental-ee8509801-20230117. Also I have a library with peer dependency react >=0.14
When I run npm i I got following error
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-jvectormap#0.0.16
npm ERR! Found: react-dom#0.0.0-experimental-ee8509801-20230117
npm ERR! node_modules/react-dom
npm ERR! react-dom#"^0.0.0-experimental-ee8509801-20230117" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-dom#">=0.14" from react-jvectormap#0.0.16
npm ERR! node_modules/react-jvectormap
npm ERR! react-jvectormap#"0.0.16" from the root project
Is that a way to tell npm that this version of react is OK for peer dependency? I tried to use overrides and legacy-peer-deps=true in my .npmrc but got the same error.
Node version v16.19.0, npm version 8.19.3
Finally found out correct configuration using overrides:
"overrides": {
"react": "$react",
"react-dom": "$react-dom"
}
i am using react native to build a app every time I try to install a npm package i have to use --force, or --legacy-peer-deps to make it install else i get error so i thought it is because of version of react in my pakgage.json so i dissided to downgrade my react to 17.0.1 from 18.1.0 and i deleted my pakage.lock.json and node modules and i tried npm i then I am getting this error i want to get a clean installation for react native
npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: sukprsavam#0.0.1
npm ERR! Found: react#17.0.1
npm ERR! node_modules/react
npm ERR! react#"17.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native#"^0.0.0-0 || 0.60 - 0.71 || 1000.0.0" from #react-native-async-storage/async-storage#1.17.11
npm ERR! node_modules/#react-native-async-storage/async-storage
npm ERR! #react-native-async-storage/async-storage#"^1.17.11" 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! peer react#"18.1.0" from react-native#0.70.6
npm ERR! node_modules/react-native
npm ERR! react-native#"0.70.6" from the root project
npm ERR! peer react-native#"^0.0.0-0 || 0.60 - 0.71 || 1000.0.0" from #react-native-async-storage/async-storage#1.17.11
npm ERR! node_modules/#react-native-async-storage/async-storage
npm ERR! #react-native-async-storage/async-storage#"^1.17.11" 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!
npm ERR! See C:\Users\vivek\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\vivek\AppData\Local\npm-cache\_logs\2023-01-04T06_02_30_598Z-debug-0.log
"name": "newapp",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
},
"dependencies": {
"#react-navigation/native": "^6.1.1",
"#react-navigation/native-stack": "^6.9.7",
"axios": "^1.2.2",
"expo": "~47.0.9",
"expo-status-bar": "~1.4.2",
"moment": "^2.29.4",
"react": "18.1.0",
"react-client-session": "^0.0.8",
"react-native": "0.70.5",
"react-native-network-logger": "^1.13.0",
"react-native-paper": "^5.1.2",
"react-native-safe-area-context": "4.4.1",
"react-native-screens": "~3.18.0",
"react-navigation": "^4.4.4"
},
"devDependencies": {
"#babel/core": "^7.12.9"
},
"private": true
}
It is my first time to clone react project from github
i did:
$ git clone <link>
after that:
npm install
but i faced an error with google-maps-react
$ npm install --save google-maps-react
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: #iso/here#4.0.0
npm ERR! Found: react#17.0.2
npm ERR! node_modules/react
npm ERR! react#"^17.0.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"~0.14.8 || ^15.0.0 || ^16.0.0" from google-maps-react#2.0.6
npm ERR! node_modules/google-maps-react
npm ERR! google-maps-react#"^2.0.6" 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!
npm ERR! See C:\Users\user\AppData\Local\npm-cache\eresolve-report.txt for a full report.
i tried:
$ npm cache clean --force
$ npm install -g npm
,:
$npm config set legacy-peer-deps true
,:
npm install --force
,:
npm install --save --legacy-peer-deps
,:
rm -rf node_modules
and more ..
node js version:
16.13.2
react version:
17.0.2
npm version:
8.4.1
nothing seem to work
am i missing something?
The project has a peer dependency on React 15 or 16 and you are using 17.0.2 - The npm error states the reason
Downgrade your react version if you want to use this library as is or change the package.json for the lib, test and confirm to the author that they are good on 17.0.2 raising a PR
"peerDependencies": {
"react": "~0.14.8 || ^15.0.0 || ^16.0.0",
"react-dom": "~0.14.8 || ^15.0.0 || ^16.0.0"
},
Here's npm telling you reason in the log
npm ERR! Fix the upstream dependency conflict, or retry
Solution:
The app is using "yarn"
I'm able now to run the app after installing "yarn add node-sass"
$ npm i #aws-cdk/aws-ec2
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: cdk_sample#0.1.0
npm ERR! Found: #aws-cdk/core#1.95.0
npm ERR! node_modules/#aws-cdk/core
npm ERR! #aws-cdk/core#"1.95.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #aws-cdk/core#"1.95.1" from #aws-cdk/aws-iam#1.95.1
npm ERR! node_modules/#aws-cdk/aws-iam
npm ERR! peer #aws-cdk/aws-iam#"1.95.1" from #aws-cdk/aws-ec2#1.95.1
npm ERR! node_modules/#aws-cdk/aws-ec2
npm ERR! #aws-cdk/aws-ec2#"*" from the root project
npm ERR! peer #aws-cdk/aws-iam#"1.95.1" from #aws-cdk/aws-cloudwatch#1.95.1
npm ERR! node_modules/#aws-cdk/aws-cloudwatch
npm ERR! peer #aws-cdk/aws-cloudwatch#"1.95.1" from #aws-cdk/aws-ec2#1.95.1
npm ERR! node_modules/#aws-cdk/aws-ec2
npm ERR! #aws-cdk/aws-ec2#"*" 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!
npm ERR! See /home/sean/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/sean/.npm/_logs/2021-03-27T00_41_58_124Z-debug.log
sean#desktop:~/WebstormProjects/cdkSample$ npm i #aws-cdk/aws-ec2
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: cdk_sample#0.1.0
npm ERR! Found: #aws-cdk/core#1.95.0
npm ERR! node_modules/#aws-cdk/core
npm ERR! #aws-cdk/core#"1.95.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #aws-cdk/core#"1.95.1" from #aws-cdk/aws-iam#1.95.1
npm ERR! node_modules/#aws-cdk/aws-iam
npm ERR! peer #aws-cdk/aws-iam#"1.95.1" from #aws-cdk/aws-ec2#1.95.1
npm ERR! node_modules/#aws-cdk/aws-ec2
npm ERR! #aws-cdk/aws-ec2#"*" from the root project
npm ERR! peer #aws-cdk/aws-iam#"1.95.1" from #aws-cdk/aws-cloudwatch#1.95.1
npm ERR! node_modules/#aws-cdk/aws-cloudwatch
npm ERR! peer #aws-cdk/aws-cloudwatch#"1.95.1" from #aws-cdk/aws-ec2#1.95.1
npm ERR! node_modules/#aws-cdk/aws-ec2
npm ERR! #aws-cdk/aws-ec2#"*" 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!
npm ERR! See /home/sean/.npm/eresolve-report.txt for a full report.
The --force option sounds non-ideal. What should be done to fix the upstream dependency conflict? I do know that AWS CDK is very strict when it comes to matching package versions between the core and construct libs.
// project generated via $ cdk init app --language typescript
"devDependencies": {
"#aws-cdk/assert": "1.95.0",
"#types/jest": "^26.0.10",
"#types/node": "10.17.27",
"aws-cdk": "1.95.0",
"jest": "^26.4.2",
"ts-jest": "^26.2.0",
"ts-node": "^9.0.0",
"typescript": "~3.9.7"
},
"dependencies": {
"#aws-cdk/core": "1.95.0",
"source-map-support": "^0.5.16"
}
From comments, installing the dependency with same version as of aws-cdk and #aws-cdk/core solved the issue.
npm install #aws-cdk/aws-ec2#1.95.0