使用 Capacitor CallNumber 获取无效的提供程序错误

Getting invalid provider error with Capacitor CallNumber

我正在实施 CallNumber。 如果我遵循 ionic docs,则没有提及在提供程序中包含 CallNumber,因此会引发错误:

Error: Uncaught (in promise): NullInjectorError: R3InjectorError(HomePageModule)[CallNumber -> CallNumber -> CallNumber -> CallNumber]: NullInjectorError: No provider for CallNumber!

所以我在 app.module.ts

中添加 CallNumber 作为提供商
import { CallNumber } from '@ionic-native/call-number';


@NgModule({
  declarations: [AppComponent, StudentModalPage],
  imports: [
    BrowserModule.withServerTransition({ appId: 'serverApp' }),
    BrowserTransferStateModule,
    IonicStorageModule.forRoot(),
    IonicModule.forRoot(),
    FormsModule,
    AppRoutingModule,
    HttpClientModule,
    ComponentsModule,
    ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production })
  ],
  providers: [
   CallNumber,
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
   
    {
      provide: APP_INITIALIZER,
      useFactory: (platformId: object, response: any) => {
        return () => {
          // In the server.ts we added a custom response header with information about the device requesting the app
          if (isPlatformServer(platformId)) {
            if (response && response !== null) {
              // Get custom header from the response sent from the server.ts
              const mobileDeviceHeader = response.get('mobile-device');

              // Set Ionic config mode?
            }
          }
        };
      },
      deps: [PLATFORM_ID, [new Optional(), RESPONSE]],
      multi: true
    }
  ],
  bootstrap: [AppComponent]
})
export class AppModule {

但现在我得到这个错误:

Error: Invalid provider for the NgModule 'AppModule' - only instances of Provider and Type are allowed, got: [?[object Object]?, ..., ...]

我已经搜索了 allot,但找不到解决方案,也没有理解错误,欢迎任何输入。

我遇到了类似问题的 解决方案,并更改了我添加提供商后创建的自动导入的导入:

 { CallNumber } from '@ionic-native/call-number';

至:

{ CallNumber } from '@ionic-native/call-number/ngx';