when I try to install leaflet in my existing app, it says following error.
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: [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@"^18.0.0" from [email protected]
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
When I try to do just, npm install leaflet, it gives the following error,
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'
how can i resolve it?
tried installing react-leaflet but throws error
CodePudding user response:
Make sure your node and npm version supports the react leaflet version you want to download.
CodePudding user response:
It seems your project use React v17 but the dependency needs React v18.
Try to update React with npm install react@latest
.
Or install react-leaflet
v3 if you still need React v17 for other dependencies legacy purpose.
CodePudding user response:
It might be related to the react-starter-kit
dependency. This dependency seems very old (7 years). Did you install it yourself ? What does it do ?
I suggest to remove it if you don't need it: npm uninstall react-starter-kit
. And then try to re install react-leaflet
.