没有 Facebook 的提供者(Ionic Native)

No provider for Facebook (Ionic Native)

ERROR Error: No provider for Facebook!
    &nbspat injectionError (core.es5.js:1231)
    &nbspat noProviderError (core.es5.js:1269)
    &nbspat ReflectiveInjector_.throwOrNull (core.es5.js:2770)
    &nbspat ReflectiveInjector
.getByKeyDefault (core.es5.js:2809)
    &nbspat ReflectiveInjector
.getByKey (core.es5.js:2741)
    &nbspat ReflectiveInjector
.get (core.es5.js:2610)
    &nbspat AppModuleInjector.NgModuleInjector.get (core.es5.js:3578)
    &nbspat resolveDep (core.es5.js:11039)
    &nbspat createClass (core.es5.js:10903)
     at createDirectiveInstance (core.es5.js:10723)
View_MyApp_Host_0 @ MyApp_Host.html:1

您需要在 AppModuleapp.module.ts 文件)中添加 Facebook

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


@NgModule({
    declarations: [...],
    imports: [...],
    bootstrap: [IonicApp],
    entryComponents: [...],
    providers: [
        // ...
        Facebook // <--- Here!
        // ...
        { provide: ErrorHandler, useClass: IonicErrorHandler }
    ]
})
export class AppModule { }

所选答案适用于 Ionic3。对于 离子 4+: 在哪个 模块有使用FB登录的组件,添加:

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

[注意/ngx]

并为该 @NgModule 添加提供程序

providers: [ Facebook, .... ]