When I try to install the react-to-pdf package with npm install react-to-pdf, I get this error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: my-portfolio-app@0.0.0
npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR! react@"^18.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.5.2" from react-to-pdf@0.0.14
npm ERR! node_modules/react-to-pdf
npm ERR! react-to-pdf@"*" 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!
npm ERR! For a full report see:
npm ERR! C:\Users\ga\AppData\Local\npm-cache\_logs\2023-07-10T14_01_46_021Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in: C:\Users\ga\AppData\Local\npm-cache\_logs\2023-07-10T14_01_46_021Z-debug-0.log
PS F:\PaperClip\my-Portfolio-app>
>Solution :
The react version you re running is 18.2.0 and it’s not supported by react-to-pdf try running to fix conflict:
npm i react-to-pdf –legacy-peer-deps