reactjs 无法安装React传单[重复]

6ojccjat  于 2023-01-05  发布在  React
关注(0)|答案(3)|浏览(119)

此问题在此处已有答案

Why ERR! ERESOLVE unable to resolve dependency tree is thrown and how to resolve it?(1个答案)
昨天关门了。
当我尝试在我现有的应用程序中安装传单时,它显示以下错误。

ERROR:
PS C:\Users\baral\OneDrive\Desktop\react-starter-kit-master> npm install react-leaflet
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree   
npm ERR! 
npm ERR! While resolving: react-starter-kit@1.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@"^18.0.0" from react-leaflet@4.2.0
npm ERR! node_modules/react-leaflet
npm ERR!   react-leaflet@"*" 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\baral\AppData\Local\npm-cache\_logs\2023-01-02T10_33_19_748Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\baral\AppData\Local\npm-cache\_logs\2023-01-02T10_33_19_748Z-debug-0.log

当我尝试做刚刚,npm安装传单,它给出了以下错误,

ERROR:
Compiled with problems:X

ERROR in ./src/views/Maps/index.jsx 2:0-71
Module not found: Error: Can't resolve 'react-leaflet' in 'C:\Users\baral\OneDrive\Desktop\react-starter-kit-master\src\views\Maps'

我该怎么解决呢?
尝试安装React瓣叶,但出现错误

vu8f3i0k

vu8f3i0k1#

确保你的节点和npm版本支持你想要下载的react传单版本。

iaqfqrcu

iaqfqrcu2#

您的项目似乎使用React v17,但依赖项需要React v18。
尝试使用npm install react@latest更新React。
或者,如果您仍然需要React v17用于其他依赖项遗留用途,请安装react-leaflet v3。

55ooxyrt

55ooxyrt3#

这可能与react-starter-kit依赖有关。这个依赖看起来很旧(7年以上)。你自己安装的吗?它是做什么的?
我建议如果你不需要的话就把它去掉:npm uninstall react-starter-kit。然后尝试重新安装react-leaflet

相关问题