Ionic 4 cordova cordova-plugin-facebook4:'FacebookOriginal'类型中缺少属性'provide'

Raz*_*van 4 cordova ionic4 angular6

我遇到了Ionic 4,Cordova,Angular6应用程序的问题.在cordova-plugin-facebook4安装并添加到app.module.ts文件之后,TS编译器会产生以下错误:

[ng] ? ?wdm?: Compiled successfully.
[ng] ERROR in src/app/app.module.ts(13,11): error TS2345: Argument of type '{ declarations: (typeof AppComponent)[]; entryComponents: undefined[]; imports: (ModuleWithProvid...' is not assignable to parameter of type 'NgModule'.
[ng]   Types of property 'providers' are incompatible.
[ng]     Type '(typeof SplashScreen | FacebookOriginal | { provide: typeof RouteReuseStrategy; useClass: typeof ...' is not assignable to type 'Provider[]'.
[ng]       Type 'typeof SplashScreen | FacebookOriginal | { provide: typeof RouteReuseStrategy; useClass: typeof I...' is not assignable to type 'Provider'.
[ng]         Type 'FacebookOriginal' is not assignable to type 'Provider'.
[ng]           Type 'FacebookOriginal' is not assignable to type 'ClassProvider'.
[ng]             Property 'provide' is missing in type 'FacebookOriginal'.

这是我的配置:

? Gathering environment info - done!

Ionic:

   ionic (Ionic CLI)          : 4.1.2 (/usr/lib/node_modules/ionic)
   Ionic Framework            : @ionic/angular 4.0.0-beta.7
   @angular-devkit/core       : 0.7.5
   @angular-devkit/schematics : 0.7.5
   @angular/cli               : 6.1.5
   @ionic/ng-toolkit          : 1.0.8
   @ionic/schematics-angular  : 1.0.6

Cordova:

   cordova (Cordova CLI) : 8.1.1 (cordova-lib@8.1.0)
   Cordova Platforms     : android 7.1.1
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.2.0, (and 4 other plugins)
Run Code Online (Sandbox Code Playgroud)

这是app.module.ts:

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule, RouteReuseStrategy, Routes } from '@angular/router';

import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';

import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { Facebook } from '@ionic-native/facebook';

@NgModule({
  declarations: [AppComponent],
  entryComponents: [],
  imports: [
    BrowserModule,
    IonicModule.forRoot(),
    AppRoutingModule
  ],
  providers: [
    StatusBar,
    SplashScreen,
    Facebook,
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}
Run Code Online (Sandbox Code Playgroud)

此软件包也已安装并在package.json文件中可用:

"@ionic-native/facebook": "^4.15.0"
Run Code Online (Sandbox Code Playgroud)

提前感谢您的意见.

Raz*_*van 31

我设法解决了这个问题:include应该从离子本机Facebook模块的'ngx'文件夹中完成,如下所示:

import { Facebook } from '@ionic-native/facebook/ngx';

这在模块的任何文档中都不可用.