模块/node_modules/angularfire2/index.d.ts的元数据版本不匹配,找到版本4,预期3,解析符号AppModule

时间:2018-01-05 10:26:17

标签: angular firebase angularfire angular4-forms

我在我的应用程序angular4中整数angulafire2和firebase但是当我启动服务器时出现此错误:

enter image description here

我只是添加我在文档中找到的代码...我使用firebase版本4.8.0和angularfire2我从npm install文档安装

代码app.module.ts:

import { BrowserModule } from '@angular/platform-browser';
  import { NgModule } from '@angular/core';
  import { RouterModule, Routes } from '@angular/router';
  import { AngularFireModule } from 'angularfire2';
  import { AngularFireDatabase } from 'angularfire2/database';
  import { AngularFireAuth } from 'angularfire2/auth';
  import { EmployeeService } from './services/employee.service';


  import { AppComponent } from './app.component';
  import { DashboardComponent } from './components/dashboard/dashboard.component';
  import { EmployeeInfoComponent } from './components/employee-info/employee-info.component';
  import { AddEmployeeComponent } from './components/add-employee/add-employee.component';
  import { EditEmployeeComponent } from './components/edit-employee/edit-employee.component';
  import { NavbarComponent } from './components/navbar/navbar.component';
  import { SidebarComponent } from './components/sidebar/sidebar.component';
  import { LoginComponent } from './components/login/login.component';
  import { RegisterComponent } from './components/register/register.component';
  import { SettingsComponent } from './components/settings/settings.component';
  import { PageNotFoundComponent } from './components/page-not-found/page-not-found.component';

  export const FirebaseAppConfig = {
      apiKey: "<api_key>",
      authDomain: "domaine",
      databaseURL: "url database",
      projectId: "id",
      storageBucket: "storage",
      messagingSenderId: "senderid"  
  };


  const appRoutes: Routes=[
    {path:'',component:DashboardComponent},
    {path:'register',component:RegisterComponent},
    {path:'login',component:LoginComponent}
  ]

  @NgModule({
    declarations: [
      AppComponent,
      DashboardComponent,
      EmployeeInfoComponent,
      AddEmployeeComponent,
      EditEmployeeComponent,
      NavbarComponent,
      SidebarComponent,
      LoginComponent,
      RegisterComponent,
      SettingsComponent,
      PageNotFoundComponent
    ],
    imports: [
      BrowserModule,
      AngularFireModule.initializeApp(FirebaseAppConfig),
      RouterModule.forRoot(appRoutes)
    ],
    providers: [
      AngularFireDatabase,
      AngularFireAuth ,
      EmployeeService
    ],
    bootstrap: [AppComponent]
  })
  export class AppModule { }

1 个答案:

答案 0 :(得分:0)

在文件node_modules / angularfire2 / ... metadata.json中更改版本4到3