react-web-component icon indicating copy to clipboard operation
react-web-component copied to clipboard

Doesn't work with React.js 17

Open gadget2015 opened this issue 3 years ago • 2 comments

I am using CRA 5.0.0, and try to install this npm-module. Then I got this error message:

PS C:\temp\temp\helloworld> npm install react-web-component npm ERR! code ERESOLVE 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/react npm ERR! react@"^17.0.2" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer react@"^16.2.0" from [email protected] npm ERR! node_modules/react-web-component npm ERR! react-web-component@"*" 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!

gadget2015 avatar Feb 09 '22 08:02 gadget2015

Same issue with react 18.2. Is this a dead project?

dperish avatar Sep 23 '22 20:09 dperish

The library have peerDependency for react 16.2.0, so you need use the same version.

I try to force with npm install --force react-web-component and still work with react 17.0.2 because the only dependency affected is ReactDom.render and React.cloneElement, but if you use react 18 maybe don't work because the render method is replaced by createRoot (https://beta.reactjs.org/reference/react-dom/render)

Is something :)

EDIT: --legacy-peer-deps option also is an alternative

fabian-parra avatar Feb 15 '23 14:02 fabian-parra