I am trying to use agm in my angular project
So I installed npm install @agm/core --save
but when I use
AgmCoreModule.forRoot({
apiKey: 'my api'
}),
It makes an error that I can not understand :
ERROR in node_modules/@agm/core/services/google-maps-api-wrapper.d.ts(2,10): error TS2305: Module '"C:/Users/Shadi/Documents/development/iot1/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/@agm/core/services/managers/circle-manager.d.ts(2,10): error TS2305: Module '"C:/Users/Shadi/Documents/development/iot1/node_modules/rxjs/Observable"' has no exported member
'Observable'.
node_modules/@agm/core/services/managers/data-layer-manager.d.ts(2,10): error TS2305: Module '"C:/Users/Shadi/Documents/development/iot1/node_modules/rxjs/Observable"' has no exported me
mber 'Observable'.
node_modules/@agm/core/services/managers/info-window-manager.d.ts(1,10): error TS2305: Module '"C:/Users/Shadi/Documents/development/iot1/node_modules/rxjs/Observable"' has no exported m
ember 'Observable'.
node_modules/@agm/core/services/managers/kml-layer-manager.d.ts(2,10): error TS2305: Module '"C:/Users/Shadi/Documents/development/iot1/node_modules/rxjs/Observable"' has no exported mem
ber 'Observable'.
node_modules/@agm/core/services/managers/marker-manager.d.ts(2,10): error TS2305: Module '"C:/Users/Shadi/Documents/development/iot1/node_modules/rxjs/Observable"' has no exported member
'Observable'.
node_modules/@agm/core/services/managers/polygon-manager.d.ts(2,10): error TS2305: Module '"C:/Users/Shadi/Documents/development/iot1/node_modules/rxjs/Observable"' has no exported membe
r 'Observable'.
node_modules/@agm/core/services/managers/polyline-manager.d.ts(2,10): error TS2305: Module '"C:/Users/Shadi/Documents/development/iot1/node_modules/rxjs/Observable"' has no exported memb
er 'Observable'.
node_modules/rxjs/Observable.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observable'.
this is appModule :
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { FwModule } from '../fw/fw.module';
import { DashboardComponent } from './dashboard/dashboard.component';
import { SettingsComponent } from './settings/settings.component';
import {FormsModule} from '@angular/forms';
import {RouterModule} from '@angular/router';
import {appRoutes} from './app.routing';
import { TagsComponent } from './tags/tags.component';
import {DataService} from './shared/data.service';
import {TagsResolverService} from './shared/tags-resolver.service';
import {HttpClientModule} from '@angular/common/http';
import {AgmCoreModule} from '@agm/core';
@NgModule({
declarations: [
AppComponent,
DashboardComponent,
SettingsComponent,
TagsComponent
],
imports: [
BrowserModule,
FwModule,
FormsModule,
RouterModule.forRoot(appRoutes),
HttpClientModule,
AgmCoreModule.forRoot({
apiKey: 'AIzaSyAt1d6t28Sbvaa4exq2dHKOffqUCEGXoqQ'
}),
],
providers: [
DataService,
TagsResolverService
],
bootstrap: [AppComponent]
})
export class AppModule { }
I deleted node_module and installed again but the same error appear
Agm is not yet ready and compatible with Angular v6 and Rxjs v6. The issue to follow is the following:
https://github.com/SebastianM/angular-google-maps/issues/1384
The workaround, if you want to stick to v6, is to install Rxjs compat too
npm install rxjs-compat --save