3
votes

I was following https://ionicframework.com/docs/native/fcm/ to integrate Firebase into my Ionic project. It was showing runtime error, not finding a Firebase provider.

Runtime error:

enter image description here

1
Did you install and import firebase in your app and pageMahesh Jadhav
I installed Cordova and Ionic Native plugins using : $ ionic cordova plugin add cordova-plugin-fcm $ npm install --save @ionic-native/fcm . Inside app.component.ts I added import { FCM } from '@ionic-native/fcm'; constructor(private fcm: FCM) {}Tauseef Mamun

1 Answers

8
votes

This might be because you forgot to add it in your app module providers list.

Import it in your app.module.ts and add it to the providers list it should then work

import {FCM} from '@ionic-native/fcm'

@NgModule({
  ... 
  providers : [
    ... 
    FCM
  ]
})