英文:
can not install the react-to-pdf
问题
当我尝试使用 npm install react-to-pdf
安装 react-to-pdf 包时,出现了以下错误:
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\_logs23-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\_logs23-07-10T14_01_46_021Z-debug-0.log
PS F:\PaperClip\my-Portfolio-app>
英文:
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\_logs23-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\_logs23-07-10T14_01_46_021Z-debug-0.log
PS F:\PaperClip\my-Portfolio-app>
答案1
得分: 1
React 版本你正在使用的是 18.2.0,不受 react-to-pdf 支持,请尝试运行以下命令解决冲突:
npm i react-to-pdf --legacy-peer-deps
英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论