Capacitor geolocation not working

I tried installing capacitor geolocation but i am getting this error, please any suggestion?

C:\Users\Hp\Desktop\WIP\hellominna>npm install @capacitor/geolocation
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: hellominna@0.0.1
npm ERR! Found: @capacitor/core@4.7.0
npm ERR! node_modules/@capacitor/core
npm ERR! peer @capacitor/core@“^4.0.0” from @capacitor/app@4.1.1
npm ERR! node_modules/@capacitor/app
npm ERR! @capacitor/app@“4.1.1” from the root project
npm ERR! peer @capacitor/core@“^4.0.0” from @capacitor/haptics@4.1.0
npm ERR! node_modules/@capacitor/haptics
npm ERR! @capacitor/haptics@“4.1.0” from the root project
npm ERR! 2 more (@capacitor/keyboard, @capacitor/status-bar)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! @capacitor/geolocation@“" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @capacitor/core@5.1.0
npm ERR! node_modules/@capacitor/core
npm ERR! peer @capacitor/core@“^5.0.0” from @capacitor/geolocation@5.0.5
npm ERR! node_modules/@capacitor/geolocation
npm ERR! @capacitor/geolocation@"
” 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\Hp\AppData\Local\npm-cache_logs\2023-07-02T13_42_55_957Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Hp\AppData\Local\npm-cache_logs\2023-07-02T13_42_55_957Z-debug-0.log

latest version of geolocation plugin is for Capacitor 5, but you are still using Capacitor 4, so you have to install version 4 of the plugin.

npm install @capacitor/geolocation@latest-4

1 Like

Thank you so much! Working now