Angular-google-maps: TypeError: ctorParameters.map is not a function

Created on 23 Dec 2016  ·  16Comments  ·  Source: SebastianM/angular-google-maps

Iget this error: "TypeError: ctorParameters.map is not a function" and not found this library.

Steps to reproduce and a minimal demo of the problem*:

1 - npm install angular2-google-maps --save
2 - import { AgmCoreModule } from 'angular2-google-maps/core';
3 -


4 - ng serve

Most helpful comment

Hey everyone - Thanks for feedback. @fdambrosio I got mine to work by just downgrading the Google Maps rather than upgrading angular. I used 0.16 and was previously using 0.17. When I moved to 0.16 that worked fine and the error went away.
Thanks for help,
Kayla

All 16 comments

I have the exact same issue as well

@rhernandez-itemsoft @kmmartell can you update to the latest angular version and try it again?

I had the same problem and it disappeared after updating to Angular 2.3.1

I have same issue but I can't upgrade to 2.3.1 because angular-webpack2-starter (with Universal) can't update (yet) to 2.3+

Hey everyone - Thanks for feedback. @fdambrosio I got mine to work by just downgrading the Google Maps rather than upgrading angular. I used 0.16 and was previously using 0.17. When I moved to 0.16 that worked fine and the error went away.
Thanks for help,
Kayla

thanks @kmmartell I moved to 0.16

I fixed this by running,
npm outdated

Then I updated any angular dependencies that were not latest to the latest versions. In my case

"@angular/common": "2.4.1",
"@angular/compiler": "2.4.1",
"@angular/compiler-cli": "2.4.1",
"@angular/core": "2.4.1",
"@angular/forms": "2.4.1",
"@angular/http": "2.4.1",
"@angular/platform-browser": "2.4.1",
"@angular/platform-browser-dynamic": "2.4.1",
"@angular/platform-server": "2.4.1",
"@angular/router": "3.4.1",
"@angular/upgrade": "2.4.1",

"rxjs": "5.0.1",
"zone.js": "^0.7.2"

Once I did this I received errors with

UNMET PEER DEPENDENCY [email protected]
└── UNMET PEER DEPENDENCY zone.[email protected]

So I upgraded those dependencies to latest as well.
rxjs 5.0.2
zone.js 0.7.4

After that I was able to run npm install and when it finished with no errors I was able to compile my project and run it again.

There must a breaking change in the 2.4 compiler. I will try to debug it.

thanks @wuno but now I can't upgrade to 2.4.1 because I'm using https://github.com/qdouble/angular-webpack2-starter

@fdambrosio Why can't you update your angular 2? I get that it might break some other parts of the app but if there is anything I have learned about developing with Angular2 in the past few months, it is you better get used to things constantly breaking.

@wuno because we're using Universal branch, and

"the universal starter repo is only updated to 2.1.2... Universal breaks with the newer angular updates as the angular team doesn't currently include it in their tests, that's why I've been updating the universal branch slower than the other branches"

https://github.com/qdouble/angular-webpack2-starter/issues/191

Hi @kmmartell how can you downgrade google map to 0.16?
Thanks

@agokrim npm install [email protected] --save

After some research yesterday, I'm not able to fix this. The compiler CLI 2.3 creates uncompatible code for angular 2.2 and smaller. See the details here: http://stackoverflow.com/a/41444599

So the only options are:

  • Update Angular to 2.3 (or better to the latest 2.x version)
  • or use angular2-google-maps version 0.16.0 and update angular when you are ready for it.

Sorry, but there's no other option right now!

To follow up @SebastianM 's answer, I've found that this issue is caused by any number of packages expecting the version of Angular Core to be different than what is actually installed.

I was able to figure out the cause of this issue by looking at the error report from ng build:

npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.

This helped me realize that one of my packages expected Angular to be at v2.4.4, but I'm using v2.0.1. I updated my package.json to have both packages set to my core version like this:

`"dependencies": {
    "@angular/core": "2.0.1",
    "@angular/platform-server": "2.0.1",
}`

Your issue might not be with @angular/platform-server, but I hope this helps debug it

I had the same problem...
I'm upgrated packeage.json to Angular 2.3.1

"@angular/common": "~2.3.1",
"@angular/compiler": "~2.3.1",
"@angular/core": "~2.3.1",
"@angular/forms": "~2.3.1",
"@angular/http": "~2.3.1",
Was this page helpful?
0 / 5 - 0 ratings