find and solve || findandsolve.com
Please wait.....

Uncaught TypeError: Object(...) is not a function at agm-core.js:4538



Uncaught TypeError: Object(...) is not a function
    at agm-core.js:4538
    at Object../node_modules/@agm/core/fesm5/agm-core.js (agm-core.js:4544)
    at __webpack_require__ (bootstrap:76)
    at Object../src/app/home/home.component.ts (main.js:325)
    at __webpack_require__ (bootstrap:76)
    at Object../src/app/app.module.ts (app.component.ts:8)
    at __webpack_require__ (bootstrap:76)
    at Object../src/main.ts (environment.ts:15)
    at __webpack_require__ (bootstrap:76)
    at Object.0 (main.ts:20)




Answer



If you use "@agm/core": "^1.1.0", 1.1.0 version you must update your angular core version grater then 6 and also update dependencies version
For Example

 "dependencies": {
    "@agm/core": "^1.1.0",
    "@angular/animations": "~8.0.0",
    "@angular/common": "~8.0.0",
    "@angular/compiler": "~8.0.0",
    "@angular/core": "~8.0.0",
    "@angular/forms": "~8.0.0",
    "@angular/http": "^7.2.16",
    "@angular/platform-browser": "^8.0.3",
    "@angular/platform-browser-dynamic": "~8.0.0",
    "@angular/router": "~8.0.0",
    "@ionic-native/geolocation": "^5.21.5",
    "@kolkov/angular-editor": "github:kolkov/angular-editor",
    "@ng-bootstrap/ng-bootstrap": "^6.0.0",
    "ngx-pagination": "^5.0.0",
    "ngx-toastr": "^11.3.3",
    "rxjs": "~6.4.0",
    "tslib": "^1.9.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.800.0",
    "@angular/cli": "~8.0.1",
    "@angular/compiler-cli": "~8.0.0",
    "@angular/language-service": "~8.0.0",
    "@types/googlemaps": "^3.39.2",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "^5.0.0",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.4.3"
  }

 And please check this function in your app.module.ts

import { AgmCoreModule } from '@agm/core'; //import agm core in app.module.ts



@NgModule({
  declarations: [
    AppComponent,
    ],
  imports: [
   
    AgmCoreModule.forRoot({
      apiKey: 'add key here',
      libraries: ['places']
    }),
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }





Or Change your Agm Version to


remove your current version:

npm uninstall @agm/core

then install this version:

npm i @agm/[email protected] --save

Sundar  Neupane

Sundar Neupane

I like working on projects with a team that cares about creating beautiful and usable interfaces.

Comments



Report Response