scniro / react-codemirror2

Codemirror integrated components for React
MIT License
1.65k stars 192 forks source link

Could not resolve peer dependency for React 17 #223

Closed ihollander closed 2 years ago

ihollander commented 3 years ago

The latest version of Create React App uses React 17: https://github.com/facebook/create-react-app/releases/tag/v4.0.0

When installing react-codemirror2 after using the latest version of Create React App, I received an error message regarding the React version from the peer dependencies:

$ npm install react-codemirror2 codemirror --save

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: codemirror-test@0.1.0
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@">=15.5 <=16.x" from react-codemirror2@7.2.1
npm ERR! node_modules/react-codemirror2
npm ERR!   react-codemirror2@"*" 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 /Users/ianhollander/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ianhollander/.npm/_logs/2020-11-17T14_42_25_685Z-debug.log

Steps to reproduce:

$ npx create-react-app codemirror-test
$ cd codemirror-test
$ npm install react-codemirror2 codemirror --save

I can open a PR to fix.

davidwinter commented 2 years ago

I was able to work around this by using:

npm i react-codemirror2 --legacy-peer-deps
andys8 commented 2 years ago

@elsigh This issue is still the case since the branch was merged, but not released to npm, right? If that's the case, would it be possible to release?

image

SharmaTushar1 commented 2 years ago

Is this issue fixed?? I received a similar error message while installing react-codemirror-2 for my app.

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: online-code-editor@0.1.0
npm ERR! Found: codemirror@6.0.1
npm ERR! node_modules/codemirror
npm ERR!   codemirror@"^6.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer codemirror@"5.x" from react-codemirror2-react-17@1.0.0
npm ERR! node_modules/react-codemirror2-react-17
npm ERR!   react-codemirror2-react-17@"*" 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.
Sabohatfrontend commented 1 year ago

After writing:

"engines": { "node": "14.x" } in package.json, react-codemirror2 worked correctly

kaushikc44 commented 1 year ago

Doesn't work for me ? Any way around guys ?

Sabohatfrontend commented 1 year ago

You might write like this in package.json: {"codemirror": "^5.65.9", "react": "^18.2.0", "react-codemirror2": "^7.2.1", "react-dom": "^18.2.0", "react-router-dom": "^6.3.0", }, "devDependencies": { "react-scripts": "^5.0.1" }, "engines": { "node": "16.x", "npm": "7.x" },

kaushikc44 commented 1 year ago

Nope I have react 18. Had to use uiw and install it

alimecha60 commented 1 year ago

PS C:\Users\Muhammad Ali\Desktop\codepen-clone-master\codepen-clone-master> npm install react-icons --save npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: react-codemirror2@7.2.1 npm ERR! Found: react@18.2.0 npm ERR! node_modules/react 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! peer react@"^18.2.0" from react-dom@18.2.0 npm ERR! node_modules/react-dom npm ERR! peer react-dom@"^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! react-dom@"^18.2.0" from the root project npm ERR! 3 more (react-scripts, the root project, react-icons) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer react@">=15.5 <=16.x" from react-codemirror2@7.2.1 npm ERR! node_modules/react-codemirror2 npm ERR! react-codemirror2@"^7.2.1" from the root project npm ERR! See C:\Users\Muhammad Ali\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\Muhammad Ali\AppData\Local\npm-cache_logs\2023-01-10T16_09_58_561Z-debug-0.log PS C:\Users\Muhammad Ali\Desktop\codepen-clone-master\codepen-clone-master>

nainajohri95 commented 1 year ago

Not working for me. I have tried everything but still not working

prashant042002 commented 2 months ago

npm uninstall codemirror npm i codemirror@5.65.16 npm install react-codemirror2

this work for me