'cant install react-leaflet on my react project

Running into an issue here where I cant install react-leaflet onto my project. I did

npm i react-leaflet 

and it didn't work, and I even did

npm i leaflet. 

What do I do here?



Solution 1:[1]

it might be for your node version (maybe you need to upgrade it)

you can try to delete your node_modules directory and also package.json the npm i again

  • rm -R node_modules
  • rm package-lock.json
  • npm install

also adding --legacy-peer-deps at the end of installing your package might be helpful

  • npm install react-leaflet --legacy-peer-deps

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1