问题描述
我正在尝试在我的角度项目中使用agm所以我安装了npm install @ agm/core --save但是当我使用
AgmCoreModule.forRoot({ apiKey:'我的api' }),这会导致我无法理解的错误:
I am trying to use agm in my angular projectSo I installed npm install @agm/core --savebut 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'.
这是appModule:
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 { }
我删除了node_module并再次安装,但出现了相同的错误
I deleted node_module and installed again but the same error appear
推荐答案
Agm尚未准备好并且与Angular v6和Rxjs v6兼容.遵循的问题如下:
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
如果您要坚持使用v6,则解决方法是也安装Rxjs compat
The workaround, if you want to stick to v6, is to install Rxjs compat too
npm install rxjs-compat --save
这篇关于没有导出成员“可观察"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!