-1

when trying to install agm-core, get error

npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: undefined@undefined npm ERR! Found: @angular/common@14.0.4 npm ERR! node_modules/@angular/common npm ERR! @angular/common@"^14.0.4" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer @angular/common@"^9.1.0 || ^10.0.0" from @agm/core@3.0.0-beta.0 npm ERR! node_modules/@agm/core npm ERR! @agm/core@"^3.0.0-beta.0" from the root project npm ERR! peer @agm/core@"^3.0.0-beta.0" from @angular-material-extensions/google-maps-autocomplete@8.1.0 npm ERR! node_modules/@angular-material-extensions/google-maps-autocomplete npm ERR! @angular-material-extensions/google-maps-autocomplete@"*" 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! See C:\Users\user\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\user\AppData\Local\npm-cache_logs\2022-07-05T09_18_32_425Z-debug-0.log

2 Answers2

4

You could try to install agm/core with --legacy-peer-deps. This is because this npm package contains outdated requirements for older Angular versions (version <=8) and that aborts the install.

npm install @agm/core --legacy-peer-deps
SeppeDev
  • 2,252
  • 2
  • 13
  • 26
2

After the frustration of waiting for an update on @agm/core for years (the last release was 3 years ago), I forked and made an Angular 14-compatible version myself (package).

All you need to do is to run npm i @hudsontavares/agm-core and replace the @agm/core references inside your code.

Hudson Tavares
  • 151
  • 1
  • 2
  • Thanks for the awesome work, im getting this error: Error: node_modules/@hudsontavares/agm-core/lib/services/google-maps-api-wrapper.d.ts:51:41 - error TS2314: Generic type 'MapHandlerMap' requires 1 type argument(s)." – mahen23 Jul 14 '23 at 11:52
  • 1
    @mahen23 - thanks for pointing it out. That's probably related to the package version for `@types/googlemaps.` I have it on version `^3.39.8` on a working repository. Please confirm if changing that in your repository fixes this issue. In the positive case, I'll update the README with this step AND my answer above. – Hudson Tavares Jul 15 '23 at 14:21
  • Works great, thanks for the awesome work again, having lots of issues with Capacitor Google maps. – mahen23 Aug 16 '23 at 11:28