ABCDEF
ABCDEF

Reputation: 23

Cannot install Angular Google Maps

I am unable to install Angular Google maps into my Ionic Angular project. I try to run the command npm install @agm/core --save however I get the following error:

code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: @angular/[email protected]
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"~11.2.0" 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/[email protected]
npm ERR! node_modules/@agm/core
npm ERR!   @agm/core@"*" 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.

It says it needs @angular/common version 10 or greater, my package.json is using version 11.2...:

dependencies": {
    "@angular/animations": "~11.2.0",
    "@angular/cdk": "^11.2.2",
    "@angular/common": "~11.2.0",
    "@angular/core": "~11.2.0",
    "@angular/forms": "~11.2.0",
    "@angular/material": "^11.2.2",
    "@angular/platform-browser": "~11.2.0",
    "@angular/platform-browser-dynamic": "~11.2.0",
    "@angular/router": "~11.2.0",
    "@capacitor/android": "^2.4.6",
    "@capacitor/core": "2.4.6",
    "@ionic-native/core": "^5.31.1",
    "@ionic-native/photo-viewer": "^5.31.1",
    "@ionic/angular": "^5.5.2",
    "capacitor-video-player": "^2.4.5-2",
    "com-sarriaroman-photoviewer": "^1.2.5",
    "cordova-plugin-geolocation": "^4.1.0",
    "rxjs": "~6.6.0",
    "tslib": "^2.0.0",
    "zone.js": "~0.10.2"
  },

I have tried to run ng update @angular/cli @angular/core which leads to this output:

Node.js version v15.5.1 detected.
Odd numbered Node.js versions will not enter LTS status and should not be used for production. For more information, please see https://nodejs.org/en/about/releases/.
The installed local Angular CLI version is older than the latest stable version.
Installing a temporary version to perform the update.
✔ Package successfully installed.
Node.js version v15.5.1 detected.
The Angular CLI requires a minimum Node.js version of either v12.20, v14.15, or v16.10.

However, if I try to use NVM to set my node version to 16, ng suddenly doesn't exist as a command.

Upvotes: 1

Views: 5184

Answers (1)

Areg Nikoghosyan
Areg Nikoghosyan

Reputation: 521

You have dependency conflict (incorrect and potentially broken dependency) as it says, so try to run the command with --force, or --legacy-peer-deps. If it doesn't take effect, the temporary solution is using prior versions of the Node.js (downgrading the Node.js version) as it causes this kind of errors to happen sometimes.

Upvotes: 4

Related Questions