TypeScript Error无法找到模块'angularfire2 / interfaces'离子3 angularfire2-offline

时间:2017-08-23 14:06:06

标签: typescript firebase ionic3 angularfire2 angularfire2-offline

当我想设置angularfire2-offline时,我收到此错误:

[16:02:08]  typescript: node_modules/angularfire2-offline/database/database.d.ts, line: 2 
            Cannot find module 'angularfire2/interfaces'. 

       L1:  import { AngularFireDatabase } from 'angularfire2/database';
       L2:  import { FirebaseListFactoryOpts, FirebaseObjectFactoryOpts } from 'angularfire2/interfaces';
       L3:  import { AfoListObservable } from './list/afo-list-observable';

[16:02:08]  typescript: node_modules/angularfire2-offline/database/interfaces.d.ts, line: 1 
            Cannot find module 'angularfire2/interfaces'. 

       L1:  import { FirebaseListFactoryOpts } from 'angularfire2/interfaces';

[16:02:08]  typescript: node_modules/angularfire2-offline/database/list/afo-list-observable.d.ts, line: 1 
            Cannot find module 'angularfire2/interfaces'. 

       L1:  import { FirebaseListFactoryOpts } from 'angularfire2/interfaces';
       L2:  import { ReplaySubject } from 'rxjs/ReplaySubject';

[16:02:08]  typescript: node_modules/angularfire2-offline/database/list/emulate-query.d.ts, line: 1 
            Cannot find module 'angularfire2/interfaces'. 

       L1:  import { FirebaseListFactoryOpts } from 'angularfire2/interfaces';
       L2:  export declare class EmulateQuery {
@ngModule中的

app.module.ts

@NgModule({
  declarations: [
    MyApp,
    HomePage
  ],
  imports: [
    BrowserModule,
    IonicModule.forRoot(MyApp),
    AngularFireModule.initializeApp(firebaseConfig),
    AngularFireDatabaseModule,
    AngularFireOfflineModule
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    HomePage
  ],
  providers: [
    StatusBar,
    SplashScreen,
    {provide: ErrorHandler, useClass: IonicErrorHandler}
  ]
})
export class AppModule {}

版本:

  • Ionic 3.9.2
  • CLI 3.8
  • angularfire2 4.0.0
  • angularfire2-offline 4.2.4
  • firebase 4.3.0
  • typescript 2.6.0

我正在关注这两个教程:

https://github.com/adriancarriger/angularfire2-offlinehttps://javebratt.com/offline-angularfire2/

错误突然发生。

1 个答案:

答案 0 :(得分:2)

新的angularfire2版本似乎有问题

angularfire2:4.0.0-rc.2

我降级到以前的版本,现在一切正常。

npm install angularfire2@4.0.0-rc0